[Support request] Set Automatic Featured Image for Posts in Particular Category

Home Forums Support [Support request] Set Automatic Featured Image for Posts in Particular Category

Home Forums Support Set Automatic Featured Image for Posts in Particular Category

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #645143
    Naman Nepal

    Hi,

    I was looking for a way to setup default featured image (if they are not set particularly) for posts in a particular category.

    For example: I have a category named “Press” where there are 100s of press releases and no featured image. I’d like to setup the same featured image for each of the articles under the “press” category.

    I looked into a few plugins but did not find any that let me setup conditional featured images.

    Can you help here?

    Thanks.

    #645186
    Leo
    Staff
    Customer Support

    Hi there,

    Have you tried this?
    https://wordpress.org/plugins/default-featured-image/

    Looks like their FAQ section has what you need.

    Let me know if this helps 🙂

    #645189
    Naman Nepal

    Is there a function that will let me do that without the need to using the plugin? I found a couple but I do not have knowledge in creating conditional statement within functions.

    #645193
    Leo
    Staff
    Customer Support

    Tom gave it a shot here but doesn’t look it was solved:
    https://generatepress.com/forums/topic/default-fallback-featured-image/

    Did you look at the FAQ section of that plugin?

    They have functions to for “Use a different image for some categories”.

    #645194
    Naman Nepal

    For example I use this to setup default featured image:

    <?php if ( has_post_thumbnail() ) {
    the_post_thumbnail();
    } else { ?>
    /images/default-image.jpg” alt=”<?php the_title(); ?>” />
    <?php } ?>

    But I want it to be conditioned for only that one category.

    #645405
    Leo
    Staff
    Customer Support

    Just making sure you’ve seen my reply above since we replied at the same time:
    https://generatepress.com/forums/topic/set-automatic-featured-image-for-posts-in-particular-category/#post-645193

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.