How can I Put Meta Description as Excert below Post Title?

#455108
  • Resolved Be Clever Buyer
    Rank Math free

    I am trying to add the meta description of an article below the post title and I want to do this with all posts I have.

    Like this – https://i.stack.imgur.com/sMHDV.jpg

    Theme provider support told a user to add a PHP snippet, which works perfectly with the Yoast SEO Plugin.

    This is the code that is working fine with the Yoast SEO plugin. What is that code for Rankmath?

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

    Thank you for contacting Rank Math support and bringing your concern to our attention.

    We don’t have a specific code to insert into your content to display the meta description.

    You can however create a shortcode and use our helper function to retrieve the description meta and process any variable that might be included in it. Please refer to this code:

    add_shortcode('rm_meta_description', 'rm_meta_description_shortcode' );
    
    function rm_meta_description_shortcode(){
      global $post;
      return RankMath\Post::get_meta( 'description', $post->ID );
    }

    Let us know how that goes. Looking forward to helping you.

    Thanks, it worked perfectly!

    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/#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 3 replies - 1 through 3 (of 3 total)

The ticket ‘How can I Put Meta Description as Excert below Post Title?’ is closed to new replies.