WordPress.org

Forums

Default featured image
[resolved] Disable on all Pages (9 posts)

  1. Paul Thomson
    Member
    Posted 2 years ago #

    Hello,

    Thanks for creating such a good plugin, it works very well.

    I was wondering if you could help me with the conditional tags?

    I'm trying to disable a featured image for all pages but cannot work out what code to put in the functions.php file?

    Thanks,
    Paul

    http://wordpress.org/extend/plugins/default-featured-image/

  2. Paul Thomson
    Member
    Posted 2 years ago #

    p.s. the following code is not working:

    function dfi_skip_page( $dfi_id ) {
            if ( is_page() ) {
                return 0; // invalid id
            }
            return $dfi_id; // the original featured image id
        }
        add_filter('dfi_thumbnail_id', 'dfi_skip_page' );
  3. janw.oostendorp
    Member
    Plugin Author

    Posted 2 years ago #

    Where did you put this code? I don't have time to check it now. I'll come back at you in 24 hours.

    Tnx for waiting

  4. Paul Thomson
    Member
    Posted 2 years ago #

    Hey, thanks for getting back to me, I put the code in the themes' functions.php file...

    I look forward to your response shortly,
    Paul

  5. janw.oostendorp
    Member
    Plugin Author

    Posted 2 years ago #

    I've tested that code in a clean wordpress, it works. I think something might be something on your theme?

    A few questions:
    1. Do you have the code that displays the image?
    2. Are multiple pages show on the url where the problem occurs?
    3. If you run var_dump( is_page() ) in the functions.php does it return true where the problem occurs?
    4. Did you create the theme?

    If #3 returns false at the top then the page you are viewing isn't a "real page".

    Let me know!

  6. janw.oostendorp
    Member
    Plugin Author

    Posted 2 years ago #

    PS try:

    function dfi_skip_page( $dfi_id ) {
        if ( 'page' == get_post_type() ) {
            return 0; // invalid id
        }
        return $dfi_id; // the original featured image id
    }
    add_filter('dfi_thumbnail_id', 'dfi_skip_page' );

    This way you check the post_type not the theme template

  7. Paul Thomson
    Member
    Posted 1 year ago #

    Hello Jan,

    Thanks for your response and apologies for the delay in getting back to you.

    I can confirm that my page is in fact a page, I've also tried both snippets you have provided without any success.

    Only one page is displayed on the URL, you can see here for an example page: http://www.livefreedietravelling.com/terms-and-conditions/

    I'm using a theme called Sahifa, and as the theme developer states, there is no custom processing on featured images (http://themeforest.net/item/sahifa-responsive-wordpress-newsmagazineblog/discussion/2819356?page=153).

    If you are happy to provide an email address, I can email you the corresponding pages of the theme (if you are otherwise unable to get hold of it) for you to check over the code?

    Thanks again for all your help, it's greatly appreciated.

    Paul

  8. janw.oostendorp
    Member
    Plugin Author

    Posted 1 year ago #

    Hi Paul,

    you can reach me as {my username}@gmail.com.
    I'm interested to see the code that doesn't appear to workin full.
    I can take a look at it round this time tomorrow.

  9. Jason Hines
    Member
    Posted 1 year ago #

    Never mind, I thought my pages were pages but the are actually posts.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.