WordPress.org

Support

Support » Plugins and Hacks » [Resolved] [Plugin: WordPress SEO] Using SEO Title and Meta Description in wp Loop

[Resolved] [Plugin: WordPress SEO] Using SEO Title and Meta Description in wp Loop

Viewing 10 replies - 1 through 10 (of 10 total)
  • Did some research and figured it out myself. 🙂

    <?php echo get_post_meta($post->ID, ‘_yoast_wpseo_title’, true); ?>

    And for the description it would be:

    <?php echo get_post_meta($post->ID, ‘_yoast_wpseo_metadesc’, true); ?>

    Plugin Author Joost de Valk
    Member

    @joostdevalk

    Absolutely true 🙂

    Oh, I guess we need to take it a step further.

    I installed the plugin to a wp that already has posts.

    Using the code above it does not output any title for older posts; it only outputs titles for posts that i saved after installing the wordpress seo plugin.

    Is this how it is supposed to work?

    If yes, maybe the code above should be used in some if else statement.

    Something like:
    if there is a yoast seo title display that
    else display wp_title

    Ah, now you can see, I’m not a programmer. Would be nice if anybody could provide the php code.

    Plugin Author Joost de Valk
    Member

    @joostdevalk

    Well, you’re hooking into the stored title now, you could also hook into the title function itself, try this:

    echo $wpseo_front->title();

    When I use it as is, i get the error message:

    Warning: Missing argument 1 for WPSEO_Frontend::title(),

    When i enter something like this:
    <?php echo $wpseo_front->title($postID);?> (random trial of mine)

    It works on single pages, but not on index pages.

    On index pages each entry gets the title of the index page it is displayed on, not the title for the post id of the looped element.

    Plugin Author Joost de Valk
    Member

    @joostdevalk

    Why do you want to use this title on those pages too? It just doesn’t make much sense to me I guess 🙂

    The idea is to create a custom read more link after excerpts. 🙂

    Plugin Author Joost de Valk
    Member

    @joostdevalk

    to make it work for you i’d have to apply a fix that I don’t really want to as it’d use more memory… Sorry.

    Michael
    Member

    @mbrownwebnetinteractivecom

    <?php echo get_post_meta($post->ID, ‘_yoast_wpseo_title’, true); ?>
    <?php echo get_post_meta($post->ID, ‘_yoast_wpseo_metadesc’, true); ?>

    Are just what I am looking for !!!

    What would be the PHP code for meta-keywords? =)

    Michael
    Member

    @mbrownwebnetinteractivecom

    I found the answer on my own ..

    The code I was looking for to pull the meta keywords is ..
    <?php echo get_post_meta($post->ID, ‘_yoast_wpseo_metakeywords’, true); ?>

    Hope this helps someone.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘[Resolved] [Plugin: WordPress SEO] Using SEO Title and Meta Description in wp Loop’ is closed to new replies.