• Resolved kostritsaalex

    (@kostritsaalex)


    Hi,

    I would like to customize output for “fb_og_desc” for particular pages. For example on WP Author page I would like to make it custom and created following code:

    function custom_author_meta_description() {

    if (is_author()) {
    // Get the author object
    $author = get_queried_object();

    // Get the author's first and last name
    $first_name = get_user_meta($author->ID, 'first_name', true);
    $last_name = get_user_meta($author->ID, 'last_name', true);

    // Static Text
    $description_text = "items";

    // Combine str template
    $new_description = "$first_name $last_name $description_text";

    return $new_description;
    }
    }

    add_action('fb_og_desc', 'custom_author_meta_description');




    But it doesn’t work. Could you please point out me where is the issue?
    Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support Muhammad Usama

    (@usamaazad99)

    Hi @kostritsaalex ,

    Thank you for contacting us. I hope you are doing well.

    I’ve forwarded your query to our Technical Department. They will look into this matter, and I will update you accordingly soon.

    Thanks & regards,
    WP Experts Support Team

    Plugin Support Muhammad Usama

    (@usamaazad99)

    Hi @kostritsaalex ,

    I hope you are doing well,

    Thank you for your patience. Please find the attached snippet below, which will help you achieve your goal:

    add_filter('fb_og_desc',function( $desc  ) {
    if ( is_author() ) {
    $author = get_queried_object();
    $first_name = get_user_meta($author->ID, 'first_name', true);
    $last_name = get_user_meta($author->ID, 'last_name', true);
    $new_desc = $first_name . ' ' . $last_name . "\r\n";
    $new_desc .= $desc;
    return $new_desc;
    }
    return $desc;
    }
    );

    If you have any questions or need further clarification, please feel free to ask. We are always here to help you.

    Thanks & Regards.
    WP Experts Support Team

    Plugin Support Muhammad Usama

    (@usamaazad99)

    Hi @kostritsaalex ,

    I hope you are doing well,

    We are marking this ticket as resolved due to inactivity. If you encounter any further issues, please feel free to open a new ticket.

    Have a great day!

    Thanks and regards,
    Support Team – WP Experts

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.