Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am using Yoast SEO and a custom header.

this obv means that any code that yoast uses to input all the seo stuff such as title tag and meta description wont be there.

I solved the title tag by using this code:

<title><?php
    /*
     * Print the <title> tag based on what is being viewed.
     */
    global $page, $paged;

    wp_title( '|', true, 'right' );

    // Add the blog name.
    bloginfo( 'name' );

    // Add the blog description for the home/front page.
    $site_description = get_bloginfo( 'description', 'display' );
    if ( $site_description && ( is_home() || is_front_page() ) )
        echo " | $site_description";

    // Add a page number if necessary:
    if ( $paged >= 2 || $page >= 2 )
        echo ' | ' . sprintf( __( 'Page %s', 'twentyeleven' ), max( $paged, $page ) );

    ?></title>

and that seems to work.

however, how do i get the meta descriptions to work and anything else I may need?

share|improve this question
1  
'and anything else I may need?' seems a bit open ended. Can you clarify? –  Brian Fegter Sep 1 '12 at 17:47

1 Answer 1

up vote 3 down vote accepted
+100

Yoast uses wp_head hook to output the meta description tag. Make sure you have this line in your <head>:

<?php wp_head(); ?>

For title tag, you can simplify the code by using one function call:

<?php wp_title( '|', true, 'right' ); ?>

The wp_title uses a filter (same name wp_title) to let users change the title tag. And Yoast uses this filter to display the correct value set in his settings page.

Of course your code above will work, but if you look deeply into the code of Yoast's plugin, you'll see he must do some extra thing like output buffering to get your title tag and change it. It's not as simple (and fast) as using a built-in filter.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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