Title: Php help
Last modified: August 18, 2016

---

# Php help

 *  [degmsb](https://wordpress.org/support/users/degmsb/)
 * (@degmsb)
 * [20 years, 7 months ago](https://wordpress.org/support/topic/php-help-1/)
 * I am new to wordpress and I am trying to insert some php in my head template.
   What I hope to do is when the home page is live place a custom meta description
   in the page. If the home page is not live I want no meta description becasue 
   the xfish_meta plug I use will control these pages. This is what I have currently:
 * <?php if ( is_home() ) {?>
    <meta name=”description” content=”<?php if ( is_home()){
   bloginfo(‘name’); echo ” – “; bloginfo(‘description’); }} ?>” />
 * This is working fine on the home page, but when I go to an individual post it
   leaves the “/> which I do not want. Can anyone help me fix this?
 * Here is my test page:
    Home Page: [http://degmsb0.tollfreepage.com](http://degmsb0.tollfreepage.com)
 * Individual post with problem: [http://degmsb0.tollfreepage.com/?p=20](http://degmsb0.tollfreepage.com/?p=20)
 * Thank you.

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

 *  [jaseone](https://wordpress.org/support/users/jaseone/)
 * (@jaseone)
 * [20 years, 7 months ago](https://wordpress.org/support/topic/php-help-1/#post-273563)
 * Change it to:
 * `<?php if ( is_home() ) {?>
    <meta name="description" content="<?php if ( is_home()){
   bloginfo('name'); echo " - "; bloginfo('description'); } echo "/>"; } ?>"
 *  Thread Starter [degmsb](https://wordpress.org/support/users/degmsb/)
 * (@degmsb)
 * [20 years, 7 months ago](https://wordpress.org/support/topic/php-help-1/#post-273577)
 * Thank you for the quick response. This almost works, but when the page is not
   my home page it places an extra quote mark in the page under the title. See here:
   [http://degmsb0.tollfreepage.com/?p=20](http://degmsb0.tollfreepage.com/?p=20)
 * Secondly the description appears like this on the home page:
 * <meta name=”description” content=”Motorcycle Helmets – This is a test blog/>”
 * Instead I need it like the below with the quote inside the />
 * <meta name=”description” content=”Motorcycle Helmets – This is a test blog â€
   œ />
 * I tried to modify but could not get it to work.
 * Do you have any other suggestions?
 * Thank you again.
 *  [jaseone](https://wordpress.org/support/users/jaseone/)
 * (@jaseone)
 * [20 years, 7 months ago](https://wordpress.org/support/topic/php-help-1/#post-273580)
 * Oh crap, stuffed up my copy & paste, try this instead sorry about that:
 * `<?php if ( is_home() ) {?>
    <meta name="description" content="<?php if ( is_home()){
   bloginfo('name'); echo " - "; bloginfo('description'); } echo "\"/>"; } ?>
 *  Thread Starter [degmsb](https://wordpress.org/support/users/degmsb/)
 * (@degmsb)
 * [20 years, 7 months ago](https://wordpress.org/support/topic/php-help-1/#post-273606)
 * Worked Perfect, Thank you so much!!!

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

The topic ‘Php help’ is closed to new replies.

## Tags

 * [description](https://wordpress.org/support/topic-tag/description/)
 * [is_home](https://wordpress.org/support/topic-tag/is_home/)
 * [php](https://wordpress.org/support/topic-tag/php/)
 * [plug](https://wordpress.org/support/topic-tag/plug/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 4 replies
 * 2 participants
 * Last reply from: [degmsb](https://wordpress.org/support/users/degmsb/)
 * Last activity: [20 years, 7 months ago](https://wordpress.org/support/topic/php-help-1/#post-273606)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
