0

I have just made my first theme for WordPress and I have been searching for information or some kind of tutorial, about how to create some sort of very simple plugin to handle unique titles and meta description for the pages and blog posts.

Is this very complicated? Where can I find info about this?

Preciate some help and guidance to solve this and to be able to develop my skills and a SEO friendly theme.

I'm also curious why I can't use a real SEO plugin like WordPress SEO by Yoast? Despite that I can write a unique title and meta description for each page and blogpost, I just a get the same title on every page and blogpost when I'm viewing my site! Is something missing in my theme?

Thanks!

1

1 Answer 1

2

Is something missing in my theme?

Most likely. If you're using WordPress 4.1, make sure there is no <title /> in your header.php and add the following to your functions.php:

add_theme_support( 'title-tag' );

Otherwise, make sure the title tag looks like:

<title><?php wp_title( '' ) ?></title>

You should also have <?php wp_head() ?> within your <head />, this allows WordPress & other plugins to kick out all sorts of stuff to function correctly.

2
  • Thanks! When I used <title><?php wp_title( '' ) ?></title> it worked perfect! I guess I don't need add_theme_support( 'title-tag' ); in the functions.php then? Despite that the SEO plugin is working, I would like to know how to code this on my own! Any tips?
    – 3D-kreativ
    Commented Mar 6, 2015 at 22:11
  • I would recommend the title-tag theme support approach - it's the new "proper" way to support dynamic titles in your theme. As for coding your own SEO plugin, that's a bit beyond the scope of this question. More importantly, why would you want to!? Commented Mar 6, 2015 at 23:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.