Title: Use conditionally
Last modified: September 7, 2016

---

# Use conditionally

 *  Resolved [gulliver](https://wordpress.org/support/users/gulliver/)
 * (@gulliver)
 * [9 years, 9 months ago](https://wordpress.org/support/topic/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)

 *  Anonymous User
 * (@anonymized-10039203)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/use-conditionally/#post-9056243)
 * If you use the plugin you dont need to add any code in your files
 *  Thread Starter [gulliver](https://wordpress.org/support/users/gulliver/)
 * (@gulliver)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/use-conditionally/#post-9070801)
 * @matswes… Thanks.
 * As it was awhile ago when I posted the question, and my memory isn’t as good 
   as I’d like, I’m not sure just what I was trying to do – so please consider this
   resolved.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Use conditionally’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/easy-wp-meta-description.svg)
 * [Easy WP Meta Description](https://wordpress.org/plugins/easy-wp-meta-description/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/easy-wp-meta-description/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/easy-wp-meta-description/)
 * [Active Topics](https://wordpress.org/support/plugin/easy-wp-meta-description/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/easy-wp-meta-description/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/easy-wp-meta-description/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [gulliver](https://wordpress.org/support/users/gulliver/)
 * Last activity: [9 years, 1 month ago](https://wordpress.org/support/topic/use-conditionally/#post-9070801)
 * Status: resolved