• nice plugin…
    I am trying to set up one default image for the category and i managed by pasting in functions.php of my theme

    function dfi_category( $dfi_id ) {
      if ( has_category( '4' ) ) {
        return 51; // the image id
      } 
    
      return $dfi_id; // the original featured image id
    }
    add_filter('dfi_thumbnail_id', 'dfi_category' );

    now my question is this… if i set in my category id=4 in any post a featured image it overrides the category main default image

    I want to display the featured image of the category on the header and under it each post to have the default features image or a custom one. But i want the category featured image that i set in the functions.php not to be changed when i changethe post featured images of that category

    this is what i use to display the featured image in the header
    <?php
    if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it.
    the_post_thumbnail();
    }
    ?>

    https://wordpress.org/plugins/default-featured-image/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author janw.oostendorp

    (@janwoostendorp)

    Hello Nemanja,

    sorry for the late response, I’ll get back at you later today after work.

    Plugin Author janw.oostendorp

    (@janwoostendorp)

    Hello Nemanja,

    Again sorry for the late response. Been really busy.
    I’m not sure what you want to do.

    You want always to show the category image (for cat 4) even when the single post has a featured image? To do that you should change the header code:

    <?php
    if ( has_category( '4' ) ) {
      echo get_the_post_thumbnail(51);
    } else if ( has_post_thumbnail() ) {
      the_post_thumbnail();
    }
    ?>

    Again I’m not sure if this is what you are asking.

    Plugin Author janw.oostendorp

    (@janwoostendorp)

    Hello Nemanja,

    did my response help?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Category default image and the single post default image’ is closed to new replies.