WordPress.org

Ready to get started?Download WordPress

Forums

WordPress SEO by Yoast
[resolved] <image> blocks in sitemaps don't show featured image (9 posts)

  1. Aahan Krish
    Member
    Posted 2 years ago #

    Hi Joost,

    I do understand that this is a design decision, but the problem is my theme is coded in a way that the "featured image" is the main image in a post.

    Is there a way for me to modify the plugin so that it considers all the attachments of a post instead of just the ones in post_content?

    -----

    Just so you know, I have tried using this in functions.php:

    add_filter('the_content', 'add_extra_content');
    function add_extra_content($content){
    	if(is_single()){
    		$content = '<p style="text-align: center;">' . get_the_post_thumbnail( $post->ID, 'full' ) . '</p>' . $content;
    	}
    	    return $content;
    }

    But the sitemaps still don't show the featured image -- probably because the image is NOT written to post_content in DB. :(

    Any help is appreciated. Thanks!

    http://wordpress.org/extend/plugins/wordpress-seo/

  2. Joost de Valk
    Member
    Plugin Author

    Posted 2 years ago #

    Next release will fix this and try to add the post thumbnail too :)

  3. Aahan Krish
    Member
    Posted 2 years ago #

    Great news, thank you Joost.

  4. Joost de Valk
    Member
    Plugin Author

    Posted 2 years ago #

    It should be in there now :)

  5. Aahan Krish
    Member
    Posted 2 years ago #

    Updated this morning. You beat my expectations with that really quick update. Again, thank you. :)

  6. Joost de Valk
    Member
    Plugin Author

    Posted 2 years ago #

    That's what I try to do ;)

  7. Aahan Krish
    Member
    Posted 2 years ago #

    Hi Joost, I don't know if this is a bug, but all my posts show the same image (the "featured image" of the latest post -- as per the published date). For example, please take a look at this (source): view-source:http://whatthenerd.com/post-sitemap.xml

    Sorry I didn't realize it early enough.

  8. Joost de Valk
    Member
    Plugin Author

    Posted 2 years ago #

    Ah, that's a bug. Will be fixed in 1.1.7, you can fix it by editing inc/class-sitemaps.php and changing $post->ID to $p->ID on line 336.

  9. Aahan Krish
    Member
    Posted 2 years ago #

    BOOM! The fix worked like a charm! :D

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic