Need help with a wordpress plugin no response from wp forum yet :(

Discussion in 'PHP' started by chetandhiman, Sep 21, 2010.

  1. #1
    Hi I am very new to wordpress I hope many of us here use or have used wordpress. I recently setup a blog on wp and installed a plug-in called Page Meta to add Meta Tags (title description and keywords to every page) There is one very confusing instruction on #3 that I am not able to follow. I need help with it. I posted in WP forums but have not received any reply yet. I hope here I will surly get some help.
    Here is the link to the post that I have made in WP forum and link to plug-in page
    WP forum post
    Plug-in

    I just need help understating the php code and few instructions on how to edit php template and customized it according to my needs.
     
    chetandhiman, Sep 21, 2010 IP
  2. guardian999

    guardian999 Well-Known Member

    Messages:
    376
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    103
    #2
    You need to change wp_title() to <?php if (function_exists('meta_title')) { meta_title(); } else { wp_title(); } ?>

    you can find it in header between title tag (<title>PASTE HERE</title>)
     
    guardian999, Sep 21, 2010 IP
  3. chetandhiman

    chetandhiman Member

    Messages:
    42
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    41
    #3
    Here is the code between my <title></title> tag
    title><?php if (is_home()) {
    	echo bloginfo('name');
    } elseif (is_404()) {
    	echo '404 Not Found';
    } elseif (is_category()) {
    	echo 'Category:'; wp_title('');
    } elseif (is_search()) {
    	echo 'Search Results';
    } elseif ( is_day() || is_month() || is_year() ) {
    	echo 'Archives:'; wp_title('');
    } else {
    	echo bloginfo('name'); echo wp_title('');
    }
    ?></title>
    PHP:
    According to the instructions it should be this:

    title><?php if (is_home()) {
    	echo bloginfo('name');
    } elseif (is_404()) {
    	echo '404 Not Found';
    } elseif (is_category()) {
    	echo 'Category:'; if (function_exists('meta_title')) { meta_title(); } else { wp_title(); }
    } elseif (is_search()) {
    	echo 'Search Results';
    } elseif ( is_day() || is_month() || is_year() ) {
    	echo 'Archives:'; if (function_exists('meta_title')) { meta_title(); } else { wp_title(); }
    } else {
    	echo bloginfo('name'); echo if (function_exists('meta_title')) { meta_title(); } else { wp_title(); }
    }
    ?></title>
    PHP:
    If I am doing right it shows only a blank page :(
     
    chetandhiman, Sep 21, 2010 IP
  4. guardian999

    guardian999 Well-Known Member

    Messages:
    376
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    103
    #4
    here is
    <title><?php if (is_home()) {
        echo bloginfo('name');
    } elseif (is_404()) {
        echo '404 Not Found';
    } elseif (is_category()) {
        echo 'Category:'; 
        if (function_exists('meta_title')) { meta_title(); } else { wp_title();}
    } elseif (is_search()) {
        echo 'Search Results';
    } elseif ( is_day() || is_month() || is_year() ) {
        echo 'Archives:'; 
        if (function_exists('meta_title')) { meta_title(); } else { wp_title(); }
    } else {
        echo bloginfo('name'); 
        if (function_exists('meta_title')) { meta_title(); } else { wp_title(); }
    }
    ?></title>
    PHP:
     
    guardian999, Sep 21, 2010 IP
  5. chetandhiman

    chetandhiman Member

    Messages:
    42
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    41
    #5
    I will check with the code and let you know. Thanks!
     
    Last edited: Sep 22, 2010
    chetandhiman, Sep 22, 2010 IP
  6. chetandhiman

    chetandhiman Member

    Messages:
    42
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    41
    #6
    Code is working fine. I made some more changes and everything is working fine according to my will :)
    Here is the code:
    <title><?php if (is_home()) {
        echo 'Title Text.';
    } elseif (is_404()) {
        echo '404 Not Found';
    } elseif (is_category()) {
        echo 'Category:'; 
        if (function_exists('meta_title')) { meta_title(); } else { wp_title();}
    } elseif (is_search()) {
        echo 'Search Results';
    } elseif ( is_day() || is_month() || is_year() ) {
        echo 'Archives:'; 
        if (function_exists('meta_title')) { meta_title(); } else { wp_title(); }
    } else {
        echo bloginfo('name'); 
        if (function_exists('meta_title')) { meta_title(); } else { wp_title(); }
    }
    ?></title>
    
    <?php
    if  (is_home()) {
    echo "<meta name=\"description\" content=\"Description Text \" />\n";
    }
    ?>
    PHP:
    Now I am able to add my own description and title meta tags :)
    Thanks for your help.
     
    chetandhiman, Sep 22, 2010 IP