json jobtitle

  • Hello,

    I have modified my theme to add the profession next to the name as you can see here :

    URL (sensitive data)

    –> Jimmy THAI, Science Journalist

    I cheated a little. To display the profession, I use the “last_name” input in the WordPress profile.

    (because I don’t have the skills to create a new input etc.).

    Now I’d just like to add it to the “json.”

    Currently I have this

    author
    @type Person
    name Jimmy THAI

    Can you help me add “jobTitle”: $last_name

    I don’t know if you get the idea…

    Many thanks for help

Viewing 12 replies - 1 through 12 (of 12 total)
  • Hello,

    Thank you for contacting Rank Math today.

    From what I could gather from your description, you can make use of the following code snippet to get the last name from the post author and populate it on the schema data:

    /**
     * Filter to Short-circuit Schema if a 3rd party is interested in generating their own data.
     * Replace $schmea_type with schema name like article, review, etc.
     * @param array $entity Snippet Data
     * @return array
     */
    add_filter( "rank_math/snippet/rich_snippet_blogposting_entity", function( $entity ) {
     $fname = get_the_author_meta('first_name');
     $lname = get_the_author_meta('last_name');
     $entity['author']['name'] = $fname.", ".$lname;
     return $entity;
    });

    Looking forward to helping you. Thank you.

    ​​​​​​​

    Hello 🙂 many thanks for help.
    @Michael Davis

    I don’t understand how I can use this code.

    I try to add in functions.php but nothing happened.

    Hello,

    Thanks for getting back to us.

    We might need to take a closer look at the settings. Please edit the first post on this ticket and include your WP logins in the designated Sensitive Data section.
    Sensitive Data Section

    It is completely secure and only our support staff has access to that section. If you want, you can use the below plugin to generate a temporary login URL to your website and share that with us instead:

    Temporary Login Without Password

    You can use the above plugin in conjunction with the WP Security Audit Log to monitor what changes our staff might make on your website (if any):

    WP Security Audit Log

    We really look forward to helping you.

    Hello,

    I have updated the sensitive data as requested. Can you please check further?

    Thank you.

    @michaeldavis
    Done I add info

    Can you help me ?

    Many Thanks !

    Here the page : https://forum-cetogene.com/beta/2019/12/27/test-recette/

    I would like to add JobTitle: Scientist to json data

    I have modified my theme to add the profession next to the name as you can see here :

    URL (sensitive data)

    –> Jimmy THAI, Science Journalist

    I cheated a little. To display the profession, I use the “last_name” input in the WordPress profile.

    (because I don’t have the skills to create a new input etc.).

    Now I’d just like to add it to the “json.”

    Currently I have this

    author
    @type Person
    name Jimmy THAI

    Can you help me add “jobTitle”: $last_name

    Hello,

    Thanks for the access.

    I have modified the code to the following:

    /**
     * Filter to Short-circuit Schema if a 3rd party is interested in generating their own data.
     * Replace $schmea_type with schema name like article, review, etc.
     * @param array $entity Snippet Data
     * @return array
     */
    add_filter( "rank_math/snippet/rich_snippet_article_entity", function( $entity ) {
     $fname = get_the_author_meta('first_name');
     $lname = get_the_author_meta('last_name');
     $entity['author']['name'] = $fname.", ".$lname;
     return $entity;
    });
    

    To fix the rest of the errors you will need to:
    – Head over to Rank Math > Titles & Meta > Local SEO and add a logo.
    – Add a featured image to your posts.

    I hope this info helps. Thank you.

    ???? Did you read my answers ??
    I Want to add JobTitle in json

    Hi there,

    I am not sure what you mean by JSON, the above code is modifying the post author on the schema data and adding the job title, here is an example:
    Schema

    Do you want to add this on a different location?

    Thank you.

    I would like something like this

    @type Person
    Name Jimmy
    JobTitle Scientist

    Hello,

    Thanks for the clarification.

    I have modified the code to the below:

    /**
     * Filter to Short-circuit Schema if a 3rd party is interested in generating their own data.
     * Replace $schmea_type with schema name like article, review, etc.
     * @param array $entity Snippet Data
     * @return array
     */
    add_filter( "rank_math/snippet/rich_snippet_article_entity", function( $entity ) {
     
     $lname = get_the_author_meta('last_name');
    	if(isset($lname)){
     	$entity['author']['jobTitle'] = $lname;
    		return $entity;
    	}
     return $entity;
    });

    Could you please let me know if this works as expected?

    Thank you.

    Good morning,

    That’s exactly what I’ve been trying to do for days!
    Thank you so much for the help !!!
    Have a great day !

    Hello,

    We are super happy that this resolved your issue. If you have any other questions in the future, know that we are here to help you.

    If you don’t mind me asking, could you please leave us a review (if you haven’t already) on https://wordpress.org/support/plugin/seo-by-rank-math/reviews/?rate=5#new-post about your overall experience with Rank Math? We appreciate your time and patience.

    If you do have another question in the future, please feel free to create a new forum topic, and it will be our pleasure to assist you again.

    Thank you.

Viewing 12 replies - 1 through 12 (of 12 total)

The ticket ‘json jobtitle’ is closed to new replies.