Use conditionally
-
I’ve been using…
<meta name="description" content="<?php echo strip_tags(get_the_excerpt());?>">
And it works ok for pages, but for posts is unsuitable because I use ‘the excerpt’ as teasers for feeds and so a meta description which uses the excerpt isn’t ideal.
Can this be used with a conditional statement to apply only to posts and not pages, with something like…
<meta name="description" content="<?php if ( is_single() ) { WHAT DO I ADD HERE? } else { echo strip_tags(get_the_excerpt()); } ?>" />
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Use conditionally’ is closed to new replies.