This topic has 6 replies, 2 voices, and was last updated 10 years by sharmstr.

  • Author
  • #82984
     Stephanus
    Participant

    I’m trying to add a meta description to my home page (which is basically my blog, i.e. under ‘Reading Settings’, I’ve set my front page to display my latest blog posts) but I can’t figure out where/how to do this. As you can see in the attached screenshot, my home page only shows my Site Title and Tagline (which I’ve set under the General Settings).

    Please help.

    Thank you.

    Stephanus

    #83027
     sharmstr
    Moderator

    Most of us use Yoast SEO for that sort of stuff, but you can try this instead…

    COPY CODE
    
    add_action( 'wp_head', 'gen_meta_desc' );
    function gen_meta_desc()
    {
         if ( is_home() ) {
            
             echo "<meta name='description' content='This is my custom description.' />";
         }
    }
    
    
    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #83200
     Stephanus
    Participant

    Hi Sharmstr,

    Thanks for your email.

    I still have 2 questions though:

    1. Where exactly would I add the code that you sent me?
    2. I also use the Yoast SEO plugin, but how do I use the plugin to achieve my goal of adding the meta description to the home page?

    Kind regards,

    Stephanus

    #83207
     sharmstr
    Moderator

    The code goes in your child theme’s functions.php file.

    Refer to the yoast documentation.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #83216
     Stephanus
    Participant

    Thanks, Sharmstr.

    Please would you let me know how to do this using Yoast SEO instead, i.e. where in Yoast SEO I can find the meta description block where I need to add my description?

    #84908
     Stephanus
    Participant

    Hi Sharmstr, please would you let me know how to do this using Yoast SEO instead, i.e. where – in Yoast SEO – I can find the meta description block where I need to add my description?

    #84921
     sharmstr
    Moderator

    Hey Stephanus – As mentioned, its in the Yoast documentation: http://kb.yoast.com/article/146-yoast-wordpress-seo-titles-metas-template-variables

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.

Log in with your credentials

Forgot your details?