• Resolved marketinglss

    (@marketinglss)


    Hi,

    I have just started using you plugin, it works perfectly thank you.

    I have one issue with it though as it is overiding the plugin
    ‘Hide Featured Image’ to hide the default image showing on the post/page/article.

    Is there a workaround for this or an alternative means of hiding the feature image on the top of the article?

    Thanks.

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

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

    (@janwoostendorp)

    If it’s only displayed on the top. (you don’t have to show it more then once on indivudual pages/posts). Then the following will work:

    function dfi_skip_page ( $dfi_id, $post_id ) {
      if ( is_singular() ) {
        return 0; // invalid id
      }
      return $dfi_id; // the original featured image id
    }
    add_filter( 'dfi_thumbnail_id', 'dfi_skip_page', 10 , 2 );
    Thread Starter marketinglss

    (@marketinglss)

    I need it to display in all references to the post while not appearing within the post at the top.

    I have other sections that are linking to these pages and I require them to have and image to be set to them, using featured image plays this role.

    The plugin ‘Hide Featured image’ Allows me to turn this image off but your plugin is overriding it.

    The code removed all trace of the image, meaning having the featured page selected effectively non-existent.

    Plugin Author janw.oostendorp

    (@janwoostendorp)

    Define the function where ever you did.

    But add the add_filter( 'dfi_thumbnail_id', 'dfi_skip_page', 10 , 2 );

    Just above the place where you want to exclude the image. Below that add a remove_filter( 'dfi_thumbnail_id', 'dfi_skip_page', 10);

    Rough example.

    <header>
    <!-- bla bla -->
    <?php add_filter( 'dfi_thumbnail_id', 'dfi_skip_page', 10 , 2 ); ?>
    <?php the_post_thumbnail() // will not show the default featured image ?>
    <?php remove_filter( 'dfi_thumbnail_id', 'dfi_skip_page', 10); ?>
    <!-- bla bla -->
    </header>
    <!-- bla bla -->
    <?php the_post_thumbnail() // will show the featured image ?>
    <!-- bla bla -->

    Let me know how it goes.

    Thread Starter marketinglss

    (@marketinglss)

    Hi, Thanks for your time.

    I looked back at what you previously stated and what you have suggested now.

    I am fairly new to this so I was using the code wrong initially.

    I have managed to work around my problem with what you have suggested.

    I am using Enigma Pro and this provides a section to add custom code.

    Here I inserted this section

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

    At the top of the page I needed to remove the image I then placed the following code.

    <?php add_filter( ‘dfi_thumbnail_id’, ‘dfi_skip_page’, 10 , 2 ); ?>

    Thank you very much for your help. Problem solved.

    Plugin Author janw.oostendorp

    (@janwoostendorp)

    A tip. so it will be better to maintain.

    Put the function definition in the theme functions.php

    // source of this function: https://wordpress.org/support/topic/plugin-confliction-hide-featured-image
    function dfi_skip_page ( $dfi_id, $post_id ) {
        if ( is_singular() ) {
            return 0; // invalid id
        }
        return $dfi_id; // the original featured image id
    }

    Only put the <?php add_filter( 'dfi_thumbnail_id', 'dfi_skip_page', 10 , 2 ); ?> above the image.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Plugin confliction – Hide Featured Image’ is closed to new replies.