How to create custom ItemList Schema for more than 10 Item in same page?

#619736
Viewing 14 replies - 31 through 44 (of 44 total)
  • Pradeep M
    Rank Math free

    Hello,

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

    Thank you.

    Hello,

    Looking at the fields you want to use it seems that all are custom fields and in such cases, you don’t need to add the variables to use the data from them.

    We already have a variable that is able to fetch custom field data automatically and it’s the following: https://rankmath.com/kb/variables-in-seo-title-description/#custom-field-advanced

    By adding the custom code you are just introducing complexity into the system without needing to.

    If there’s a particular variable that is not directly available via the custom fields, then, that’s a reason to add a custom code to fetch the data from the database but otherwise, there’s no need for it.

    Don’t hesitate to get in touch if you have any other questions.

    Hello,

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

    Thank you.

    Hello Pradeep,

    I replicated and went through your setup and the issue comes from sameAs field name mismatch (the field names used in schema definition are not similar to the actual field names as defined by your ACF configurations):
    I changed *reviewer_sameAs* to *reviewer_sameas* after comparing the field names in<home_url>/wp-admin/edit.php?post_type=acf-field-group and the reviewers sameAs picked the values (in my dev setup)
    See image below (0, 1 and 2 are now correct but number 3 and 4 are not)
    schema sameAs field ids

    Please do make those changes and do let us know how it goes.

    We apologize for any inconveniences this issue might have caused.

    Thank you

    Pradeep M
    Rank Math free

    Hello,

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

    Thank you.

    Hello,

    I think add_shortcode('reviewed_by', 'reviewed_by_helper');
    is not able to get the user data, because $author_id = get_field('reviewed_by'); does not store the id, but rather the name. See these settings under Admin Dashboard > ACF > Field Groups > reveiwedBy

    1. Solution 1: You could use get_user_by( to get the user data by the field and value stored in get_field('reviewed_by');, see WordPress docs about this https://developer.wordpress.org/reference/functions/get_user_by/
    2. Solution 2: Alter the label and value of the reviewedBy select input (ACF input)to show the label of user name and value of user id, that way your add_shortcode('reviewed_by', 'reviewed_by_helper'); will still work as it is
      See ACF docs about this https://www.advancedcustomfields.com/resources/dynamically-populate-a-select-fields-choices/

    Hello,

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

    Thank you.

    Hello,

    I see knowsAbout is showing for that page under the Article schema, see at https://validator.schema.org/#url=https%3A%2F%2Fstg-ptpioneer-ptpstandard.kinsta.cloud%2Fissa-review-personal-trainer-certification%2F

    For the other part, please add below code in your custom theme functions.php

    // Alter reviewed_by select option labels and values
    function acf_load_reviewed_by_field_choices( $field ){
            $users = get_users( [
                'fields' => ['id', 'display_name'],
                'orderby' => 'id',
                //'who' => ['authors', 'reviewers']
            ]);
    
        $users = array_column( $users,'display_name','id' );
        $field['choices'] = $users;
    
        return $field;
    }
    
    // Output reviewed_by values
    function reviewed_by_helper($atts) {
        $author_id = get_field('reviewed_by');
        $user_info = get_userdata($author_id);
        $user_name = $user_info->display_name;
        $user_url = get_author_posts_url($author_id);
    
       return '<a href="' . $user_url . '">' . $user_name . '</a>';
    }
    add_shortcode('reviewed_by', 'reviewed_by_helper');
    
    add_filter('acf/load_field/name=reviewed_by', 'acf_load_reviewed_by_field_choices');

    Then reselect the reviewed by value and save so the users id is saved instead of the display name (previous setup).

    Also you may now filter the roles to include in the select options (see who in args above)

    Please do let us know how things turn out.

    Thank you

    Hello,

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

    Thank you.

    Hello,

    I see the reviewers name is now showing correctly.

    About the author knowsabout, it seems they are all combined under reviewedBy, with a warning The property reviewedBy is not recognised by the schema (e.g. schema.org) for an object of type Article.

    for example, form this post

    Could you please point us to any other custom code you have added that’s responsible for outputting the custom fields in schemas.

    Thank you

    Hello,

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

    Thank you.

    Hello,

    I tried the page link you shared and the reviewer’s name is showing (could you try and clear your browser cache).

    On troubleshooting about the author > knowsAbout issue, Rank Math dynamically loads the author schema in relation to the current post (ie the author of the current post), eg

    $schema['author'] = [
    			'@id'  => $data['ProfilePage']['@id'],
    			'name' => get_the_author(),
    		];

    For this reason the author settings under the custom schema can’t be reached or applied.

    Please follow this guide at https://israelgaudette.com/how-to-boost-eeat-for-your-authors/
    on how to go about it.

    Once done, please do let us know, so we can help resolve any other issue that may arise from this.

    You may add the custom code in your child theme functions.php file so you may always preserve the changes even when you update other plugins or parent themes.

    Looking forward to having this issue resolved.

    Thank you

    Hello,

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

    Thank you.

    Hello,

    I see you did everything right, but forgot "Step 4: Inject Schema Sitewide", I have added another schema template named ‘knowsAbout’ and set in display condition: Insert > In Author (On Single Posts) and now those fields values are included at https://validator.schema.org/#url=https%3A%2F%2Fstg-ptpioneer-ptpstandard.kinsta.cloud%2Fissa-corrective-exercise-specialist-review%2F

    For the reviewer’s name showing up as 1, please confirm the value of that field in the posts schema, like for this post, the value is set to ‘Amanda Capritto’ instead of customfield(reviewer_by): (if after checking the value in the schema for this post and the issue is still persistent, please share the post edit link, as I’m having a hard time getting it)

    Thank you

    Hello,

    Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.

    If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.

    Thank you.

Viewing 14 replies - 31 through 44 (of 44 total)

The ticket ‘How to create custom ItemList Schema for more than 10 Item in same page?’ is closed to new replies.