WordPress.org

Ready to get started?Download WordPress

Forums

if...else problem with meta description (4 posts)

  1. FionaGilbert
    Member
    Posted 4 years ago #

    Morning all,

    I am trying to do as if..else statement but I keep getting a white screen. Could anyone tell me what I am doing wrong here please?

    Here is my code: http://paste-it.net/public/c5df1e9/

    Thank you

  2. thisisedie
    Member
    Posted 4 years ago #

    Here ya go:

    <meta name="description" content="<?php if (is_home()) { echo ('site description'); }
    elseif (is_category('arts-ents')) { echo ('Test'); }
    elseif (is_category('ely-theatre-review')) { echo ('Your guide to AD'); }
    elseif (is_category('ely-music')) { echo ('The best of music in Cambridgeshire'); }
    elseif (is_tag()) { echo '-tag archive page for this blog' . single_tag_title(); }
    elseif (is_month()) { echo 'archive page for this blog' . the_time('F, Y'); }
    else { echo get_post_meta($post->ID, "Metadescription", true); } ?>">
  3. FionaGilbert
    Member
    Posted 4 years ago #

    Fantastic! Thank you very much!

  4. thisisedie
    Member
    Posted 4 years ago #

    Your welcome :)

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags