WordPress.org

Forums

How to change the Meta description of my site?? (5 posts)

  1. Underwire Umpire
    Member
    Posted 3 years ago #

    I'm going completely nuts. Today I checked Google for underwire umpire, and the description of the site was flip flopped. It says, Life and Sports by a Former ESPN Drone, and I need it to say Sports and Life... Further, I would like to change the second sentence that shows up, "my take on the hot topics in sports today."

    I vaguely remember typing that but I can't find it for the LIFE of me... I'm desperate to change this- please, please help!!!

    my site is underwireumpire.com.

    Thank you in advance for your help!!

  2. chadrew
    Member
    Posted 3 years ago #

    Your site does not seem to have a meta description tag, and that's what Google (usually) uses in search results. So what you need to do is to edit the header.php of your theme and add the following:

    <meta name="description" content="This is your description" />

    It might be a good idea to add some conditions in there, for example, to only display this description on the home page.

    <?php if ( is_home() ) { ?>
    <meta name="description" content="This is your description" />
    <?php } ?>

    Or you could use post excerpt for meta description on post pages, and your custom description everywhere else:

    <meta name="description" content="<?php if ( is_single() OR is_page() ) { echo get_the_excerpt(); }
    else { echo 'Description for your homepage and other pages.'; } ?>" />
  3. Underwire Umpire
    Member
    Posted 3 years ago #

    Oh my goodness I had NO idea about needing to do any of this! lol seems much easier than it actually is...

    So I have found the header.php for my theme, twenty ten, but I dont know exactly where I'm supposed to put that coding? there is so much stuff in that header.php editor i have no idea where to start.

    Also, in your comment, where you have written "description" is that part of the code or am I supposed to replace that with what I want to show? I'm very sorry but I am seriously very new to ALL of this stuff and the coding just baffles me.

    Thank you SO much for your help!

  4. chadrew
    Member
    Posted 3 years ago #

    I took a quick look at Twenty Ten, and I suppose you could add it just below <meta charset="<?php bloginfo( 'charset' ); ?>" />. It shouldn't matter as long as it's between the <head> and </head> tag.

    It occurs to me that most people frown upon hardcoding things like that into the theme itself. It's probably better to pull the site description which you can enter in your Admin panel (Settings > General > Tagline).

    So having said all said, this is the code you could use in your header.php:

    <?php if ( is_home() ) { ?>
    <meta name="description" content="<?php echo get_bloginfo( 'description', 'display' ); ?>" />
    <?php } ?>

    And if you'd rather enter a meta description that is different from your site description, use this:

    <?php if ( is_home() ) { ?>
    <meta name="description" content="Sports and whatever else" />
    <?php } ?>

    The is_home() part will result in it displaying on the homepage only. Otherwise it would be displayed on post pages as well, which would cause all your pages to have the same description in Google, and you probably don't want that.

  5. govpatel
    Member
    Posted 3 years ago #

    If you using twenty ten theme then all you need to do go in Settings>>> General and add your title and description(tag line ) as that is picked by the code in header.php

Topic Closed

This topic has been closed to new replies.

About this Topic