• Hi guys,

    I have the following code in my header as i am trying to display different meta descriptions for the pages on my site when they appear in the google serps. The category pages are correctly displaying the description, as are the pages, but the single post pages are not showing the excerpt.

    Is this code correct? If so what else could be causing the problem?

    https://pastebin.com/zB7n9TNj

    Thanks

Viewing 5 replies - 1 through 5 (of 5 total)
  • the code seems correct, and is showing a meta description in the single posts in my local test blog.

    is there a possibility that any of the plugins might be interfering with the excerpt?

    try to de-activate all plugins and see if that solves the problem;
    then re-activate one plugin after the other to find out which one is causing the problem.

    link to your site?

    Looks like you need to call global $post; before you use the $post->ID. You can only access the $post global in the loop without calling the global first, IIRC.

    Thread Starter paa1605

    (@paa1605)

    Thanks for taking the time out to reply.

    Im using the all in one seo plug in so that might be effecting it. The plugin has an option where you can add your own meta description when creating a post so ive created a few new posts today and put the description in there rather than the excerpt box. The site is ladiesgolftrousers.co.uk and when i do a site:ladiesgolftrousers.co.uk test in google the single posts are currently just showing the default description so im eager to change this.

    To alchymyth, how did you test this code? I was under the impression that you have to wait for google to crawl the site before seeing a meta description update in the serps. If you could share how you tested it i would be very grateful.

    Thankyou both for your time.

    you can see the meta desctription when you look at the html code of your page in your browser:
    browser tool bar: ‘View’ ‘Source’ or similar

    from your site,
    for instance from ‘glenmuir-lilac-ladies-golf-skort’:

    <meta name="Description" content="We love this gorgeous lilac skort from Glenmuir with its fantastic detailing and heavenly colour." />

    basically, you can very quickly check what your (wordpress or plugin) code is putting out; obviously the search engine will take a while to pick that up – and you don’t have much influence on that.

    Thread Starter paa1605

    (@paa1605)

    Thanks, never thought of that!

    Cheers for the help, i’ll have a play with the plug ins and hopefully i can get it sorted.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Help needed with header code please’ is closed to new replies.