• Resolved Nikhil VJ

    (@nikhilsheth)


    Hi. I saw the instructions on another post for skipping this for pages. I put it in my theme’sfunctions.php file but there has been no effect. Copying the function below:

    function dfi_posttype_page ( $dfi_id, $post_id ) {
      if ( is_page($post_id) ) {
        return 0; //invalid ID
      }
      return $dfi_id; // the original featured image id
    }
    add_filter( ‘dfi_thumbnail_id’, ‘dfi_posttype_page’, 10, 2 );

    Any assistance would be most appreciated. I’m on the Hueman theme.

    Wishing this plugin would let us toggle on or off for pages, posts, custom post types etc from the settings. Otherwise it’s a very useful plugin; big thanks to the developer.

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

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

    (@janwoostendorp)

    Hello Nikhil,

    If you change the code like this;

    
    function dfi_posttype_page ( $dfi_id, $post_id ) {
      
    var_dump($post_id); die();
      
      if ( is_page($post_id) ) {
        return 0; //invalid ID
      }
      return $dfi_id; // the original featured image id
    }
    add_filter( 'dfi_thumbnail_id', 'dfi_posttype_page', 10, 2 );
    

    Does it show the page id? Is is the correct page ID?
    If it has no effect the filter is in a wrong place.
    If it does show but the wrong page id something else is wrong.

    I suspect the theme provides the wrong post/page id.

    Debug step two would be var_dump(get_post($post_id)); die();
    For more details about the provided post.

    Let me know if this helps.

    Plugin Author Jan-Willem

    (@janwoostendorp)

    Hello Nikhil,

    Did this help?

    Thread Starter Nikhil VJ

    (@nikhilsheth)

    Hi, sorry for not writing back. It’s alright, I just changed the template in my theme to not show featured images for single pages. My theme’s template does a lot of back-and-forth, calling parts from other folders etc.. i reckoned that might be causing the issue.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Not skipping pages despite adding filter’ is closed to new replies.