• Hi,

    Is there a way to display only the posts having a header image?

    Even if I left blank the Default image URL, the post that doesn’t have a heading image are displayed with a white thumb. When looking at the code in chrome console, it looks like this: https://prntscr.com/uyzh31

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support Michael Nelson

    (@mnelson4)

    Hi @anarchoi, right now querying based on whether the post has a thumbnail image or not isn’t possible. The closest thing you could do is use a custom YARPP template and use has_post_thumbnail() function to check if there is a featured image, and if not, skip showing that post.

    But taking a step back, would it be helpful if YARPP, having found a post with no featured image, instead found the first image in a post, and use THAT for the YARPP thumbnail? That’s work we’ve been considering doing for a while…

    Let me know your thoughts and questions

    Thread Starter Winston

    (@anarchoi)

    I tried to create a custom template but yarpp-template-thumbnail.php doesn’t look like the original template when I select “thumb” in the admin area

    You can see on this screenshot here: https://prntscr.com/v57eu1
    On the left the original version and on the right the custom template.
    The custom template is unstylized and i’m not able to get it back to the original look

    Also there is a big problem with the custom template. For example, if I chose to display 10 images, then it will get 10 posts from the database, loop through the 10 posts and keep only the ones with an image. So if there’s only 3 posts with an heading image in the loop of 10 posts, then only 3 posts will be displayed instead of 10.

    I already have a plugin to automatically set the featured image based on post content

    Thanks

    Plugin Support Michael Nelson

    (@mnelson4)

    I tried to create a custom template but yarpp-template-thumbnail.php doesn’t look like the original template when I select “thumb” in the admin area

    Yes, unfortunately it works completely differently, and doesn’t look quite as good. Improving these default thumbnails is one of our upcoming priorities.

    So if there’s only 3 posts with an heading image in the loop of 10 posts, then only 3 posts will be displayed instead of 10.

    Yes, it’s not as good as actually querying for posts with featured images. I’ve logged an issue to work on adding support for that (at least allow you to use a code snippet to add it, without using a complete template.)

    For reference, when the JetPack’s plugin is showing related posts and there’s no thumbnail image, it defaults to instead show the post’s excerpt. Would it be good if YARPP did that on your site?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘display only posts with heading images’ is closed to new replies.