Support » Fixing WordPress » php – Changing Meta Tags

  • Can someone ‘please’ give a WP (nubie) & PHP (nubie) some guidenance… I am trying to use Meta Tags for ‘description’ and ‘keywords’ and I currently have them in the header.php file -OK- I would like to have different Tags – I am (thinking) about something like:
    <?php pgName=get_the_title(); -or- pgName=is_page();
    if (pgName==”Home”)
    <meta name=”description” content=”Home Stuff”
    <meta name=”keywords” content=”Home Stuff”;
    elseif (pgName==”Page 1″)
    <meta name=”description” content=”Page 1″
    <meta name=”keywords” content=”Page 1 Stuff”;
    elseif (pgName==”Page 2″)
    <meta name=”description” content=”Page 2 Stuff”
    <meta name=”keywords” content=”Page 2 Stuff”;
    <meta name=”description” content=”Default Stuff”
    <meta name=”keywords” content=”Default Stuff”;
    I am sooooo new to this stuff – would something like this even begin to work ??? If so, please ‘code’ it properly for me…
    Thanks in advance for your help,

Viewing 5 replies - 1 through 5 (of 5 total)
  • You don’t need any of this. There are HUNDREDS of wordpress plugins that do this stuff for you and you can manage them all via the WP-Admin.

    My suggestion is the All in One SEO Pack (link). You actiave that, then go to the edit page of “Page 1” and you’ll see a new edit box that asks for keywords, description, title, etc.

    All done, no PHP required. Nice and easy 🙂

    Thanks TM3909 – it wokrs great and is exactly what I was looking for…

    As of my upgrade to WP 3.1 and upgrading the Atahualpa WP theme to version 3.6.4, I no longer have entry fields for keywords and meta description when creating a new post (blog article).

    Well, I found the meta keywords and meta description fields collapsed under the heading of “custom fields” on the create post page. It used to be those custom fields including post title, etc. opened up and showed ready for data entry automatically when I selected post>new but now I have to first go to the trouble to “create new” those “custom” fields for each new post before I can enter the actual keywords and meta description for each post. It’s a lot of bother. I wonder whether it’s the Atahualpa theme upgrade or the WP 3.1 upgrade that caused the change.

    @glh49 Are you sure that the plugin All in One SEO Pack is still active? Dumb question I know, but I have to ask.

    If it is, then edit a post and look in the upper right hand corner for the “screen options” and see if the All in one seo box is checked.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘php – Changing Meta Tags’ is closed to new replies.