• Resolved dillipg

    (@dillipg)


    Hi,
    Hi, when I enable your plugin, it shows featured image on posts and pages. So I searched the forum and found your post on ‘exclude all pages from the default featured image’.

    That part is working fine, but the problem is it is showing the set default image on event plugin pages. (Simple Event Planner | Version 1.4.0 | By PressTigers)

    The page I need help with: [log in to see the link]

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

    (@janwoostendorp)

    Hi,

    I’m not sure what you are asking.
    You want to exclude all events and pages?
    But do enable DFI on posts only?

    Thread Starter dillipg

    (@dillipg)

    Hi,
    yes. want to exclude DFI on all events, directory and pages. But enable DFI on posts only.

    I tried the steps in following post: https://www.ads-software.com/support/topic/featured-image-only-on-posts/ this excluded directory and pages, but the problem was it was still showing the DFI on event. so those steps did not work.

    Plugin Author Jan-Willem

    (@janwoostendorp)

    You are very close, you just need to add the simple event planner to the exclude:

    
    <?php
    /**
     * Don't show DFI on pages posttype
     * https://www.ads-software.com/support/topic/featured-image-only-on-posts/
     */
    function dfi_support_no_pages ( $dfi_id, $post_id ) {
      $post = get_post($post_id);
      if ( 'page' === $post->post_type || 'event_listing' === $post->post_type ) {
        return 0; // false image id
      }
      return $dfi_id; // the original featured image id
    }
    add_filter( 'dfi_thumbnail_id', 'dfi_support_no_pages', 10, 2 );

    Let me know how it goes!

    • This reply was modified 5 years, 7 months ago by Jan-Willem.
    Thread Starter dillipg

    (@dillipg)

    wow, this worked. Thank you!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Featured image shows on other plugin pages’ is closed to new replies.