New author meta for article schema

#613583
  • Resolved Anonymous
    Rank Math free

    Hi

    I have created a few meta fields (ACF) for my user/author to capture information such as their knowledge and education.

    I understand that I will need to create a custom schema for this purpose. However, could you please provide me with the current article schema so that I can integrate my fields into it? This way, I won’t have to manually add the existing content to my custom schema.

    Thank you!

    Sam

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

    Thanks for contacting Rank Math and bringing your inquiry to us.

    What you want can be implemented using Custom Schema and Schema Templates. They are available only in Rank Math PRO. If you haven’t started using Rank Math PRO yet, you can choose a PRO membership of your choice and get started in no time.

    Then, you can refer to this external guide which has a similar implementation of custom fields on user pages: https://israelgaudette.com/how-to-boost-eeat-for-your-authors/

    Hope that helps and please do not hesitate to let us know if you need my assistance with anything else.

    Anonymous
    Rank Math free

    Thanks.

    I’ve gotten myself a bit stuck, I am trying to self teach myself this and maybe you can kick me in the right direction – I am currently headbutting the keyboard trying to figure out what.

    I’ve created some new user meta field via acf to capture what a author knows about

    They have ACF slugs as author_knowabout, author_knowabout2, author_knowabout3, author_knowabout4, author_knowabout5.

    To turn these into WP variable, I have used your rank_math/vars/register_extra_replacements funtion

    add_action('rank_math/vars/register_extra_replacements', function () {
        rank_math_register_var_replacement(
            'knowsabout',
            [
                'name'        => esc_html__('Author Knowns About', 'rank-math'),
                'description' => esc_html__('Author Knowns About Info', 'rank-math'),
                'variable'    => 'knowsabout',
                'example'     => knowabout_callback(),
            ],
            'knowabout_callback'
        );
    });
    function knowabout_callback() {
        global $post;
        $author_id = $post->post_author;
        $author_info1 = get_field('author_knowabout', 'user_'. $author_id );
        $author_info2 = get_field('author_knowabout_2', 'user_'. $author_id );
        $author_info3 = get_field('author_knowabout_3', 'user_'. $author_id );
        $author_info4 = get_field('author_knowabout_4', 'user_'. $author_id );
        $author_info5 = get_field('author_knowabout_5', 'user_'. $author_id );
        $author_info = $author_info1;
        if (isset($author_info2)) {
            $author_info = $author_info . ', ' . $author_info2;
        }
        if (isset($author_info3)) {
            $author_info = $author_info . ', ' . $author_info3;
        }
        if (isset($author_info4)) {
            $author_info = $author_info . ', ' . $author_info4;
        }
        if (isset($author_info5)) {
            $author_info = $author_info . ', ' . $author_info5;
        }
        return $author_info;
    }

    I have then created a custom schema called knowsabout, as per the screenshot below

    https://share.getcloudapp.com/yAu9NNwA

    This is set with insert > custom > Person as the display rules

    Where have i taken a wrong turn or have a had a full on Britney melt down?

    All help welcomed

    Anonymous
    Rank Math free

    Ahhh think i figured it out – I should be using the variable declared in the function, so set the custom schema to a single line “%knowsabout%”

    Hello,

    Thank you for the update.

    It seems that you have already managed to use the correct variable on your schema.

    Could you please confirm if you still need assistance with this one?

    Looking forward to helping you.

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

You must be logged in to reply to this ticket.