Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Jan-Willem

    (@janwoostendorp)

    Wow, that’s a tricky one. You could exclude those posts by ID. I got an example in the FAQ.
    But that would require you to keep adding post ID’s to the exception.

    I would recommend:

    1. exclude the whole poststype (again check the FAQ).
    2. Where you put echo the Featured image do an manual check if one is set.
    3. If not, get and echo the default featured image, see code below:
    <br />
    $dfi= wp_get_attachment_image( get_option( 'dfi_image_id' ), $size, false, $attr );<br />
    echo $dfi;<br />

    I hope this helps. If you get stuck let me know and I will give more detailed instructions and help where needed.

    Thread Starter MCM

    (@nathmie)

    Thanks, so I know what I want now and hope you can help.

    I think an easier solution.

    Basically I have two custom posts – I do not required default image for normal posts.

    I installed your plugin and did not specify a default image BUT I created the necessary functions for those custom posts.

    If I enable default featured image, it then works 100% BUT it then also works for POSTS! ??

    Is there a way to tell your plugin NOT to even process posts, as I have another plugin that fetches the first image in the posts and displays it as a thumbnail.

    ?

    Plugin Author Jan-Willem

    (@janwoostendorp)

    pasting below in your functions.php should exclude all posts form my plugin.

    function dfi_posttype_post( $dfi_id ) {
      if ( is_singular( 'post' ) || get_post_type() == 'post' ) {
        return 0; // it's an invalid ID
      }
      return $dfi_id; // the original featured image id
    }
    add_filter('dfi_thumbnail_id', 'dfi_posttype_post' );

    Let me know ??

    Thread Starter MCM

    (@nathmie)

    Thanks for the feedback but decided to use post format.

    Plugin Author Jan-Willem

    (@janwoostendorp)

    No problem, thanks for getting back at me ??

    Thread Starter MCM

    (@nathmie)

    ?? I actually ended up using your plugin. Thanks though I dont deserve your efforts now ??

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Default Image based on First Image in Post’ is closed to new replies.