• Resolved ars111

    (@ars111)


    Hi, when I enable your plugin, it shows featured image on posts. That part is working excellent, but the problem is it is showing image on pages. That image is not featured but first image under the title part. I’m using Avada theme.

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

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

    (@janwoostendorp)

    Hi,

    I’m not totally surewhat you want but the following snippet will exclude all pages from the default featured image.

    
    <?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 ) {
        return 0; // false image id
      }
      return $dfi_id; // the original featured image id
    }
    add_filter( 'dfi_thumbnail_id', 'dfi_support_no_pages', 10, 2 );
    

    create a file in wp-content/mu-plugins/dfi_support_no_pages.php And paste this code inside.
    (mu-plugins folder might not exist yet)

    Plugin Author Jan-Willem

    (@janwoostendorp)

    Hi,

    Did this work?
    For now I’m setting this issue to resolved.

    it wont work, error code
    still showing https://saham.news/submit

    Any idea how to disable the featured image on all pages by feature only or code php?

    I found this thread by googling this exact issue. Your code worked for me Jan, thank you very much!

    Is this something that could be easily implemented with a future update? A checkbox to change this feature would be great for folks who aren’t comfortable with code

    Plugin Author Jan-Willem

    (@janwoostendorp)

    Hi @sahamdotnews,

    Sorry for the late replay I was unavailable.
    You say you get an error, can you share the exact error message?
    The code I provided should exclude all pages.

    Plugin Author Jan-Willem

    (@janwoostendorp)

    @keezie Good to hear this worked.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Featured image only on posts’ is closed to new replies.