Default featured image
[resolved] Default image also set in portfolio items (9 posts)

  1. marcsole
    Posted 1 year ago #

    We have installed Default Featured Image for all post entries and it works like a charm!

    However, our template also has a Portfolio section with video items. These items don't need a featured image because the template shows the video.

    If we disable the plugin, the portfolio shows all videos. With your plugin enabled the default image appear. Can you help us to solve it?

    Thanks and regards,


  2. janw.oostendorp
    Plugin Author

    Posted 1 year ago #

    Hi Marcsole,

    What you want can be done. What do all these video's have in common? Are they all in the same category? Or are they all a custom posttype? Postformats?
    Is this template set with a meta data?

    If there is one factor that applies to all video's and only to video's it can be done.

    Let me know and I'll give you the code. If you can code a bit maybe you can figure it out with the FAQ examples

  3. marcsole
    Posted 1 year ago #

    Hello janw,
    These videos have in common that they are in Porfolio section. In portfolio they are in "VÍDEOS" gallery.

    They are not posts entries so they don't have posttype neither category. In the Portfolio the categories are galleries and they are marked as "VÍDEOS".

    However, I want that all portfolio items don't be applied the Default Featured Image.

    The template is La Bomba. And this page is the portfolio:

    I don't mind about coding in order to solve it.


  4. janw.oostendorp
    Plugin Author

    Posted 1 year ago #

    Okay, almost there. I need a bit more.

    1) So Portfolio is it's own menu item?
    2) galleries works the same as the categories of posts?
    2.b) if yes, what is the url of the galleries edit screen?
    Example: categories edit url is: http://dahz.daffyhazan.com/labomba/wp-admin/edit-tags.php?taxonomy=category
    Is the edit of gallery: http://dahz.daffyhazan.com/labomba/wp-admin/edit-tags.php?taxonomy=gallery
    I need the taxonomy name, exactly.
    3) what is the slug of the VÍDEOS gallery? you can should be able to find this on the edit screen.

  5. marcsole
    Posted 1 year ago #

    Hi, no problem. Let me try to understand everything.

    1) Portfolio it's a customized section of the template. We also have a menu item with that name that lists portfolio items.

    2) Yes, galleries works the same like categories. I show you admin URL in order to help:

    URL edit portfolio section: /wp-admin/edit.php?post_type=portfolio

    URL edit portfolio galleries (categories): /wp-admin/edit-tags.php?taxonomy=portfolio-gallery&post_type=portfolio

    URL edit portfolio slug gallery: /wp-admin/edit-tags.php?action=edit&taxonomy=portfolio-gallery&tag_ID=1994&post_type=portfolio

    3) The slug is "videos" and the name "VÍDEOS".

  6. janw.oostendorp
    Plugin Author

    Posted 1 year ago #

    Great that's the information I needed.

    The following code will nog show a Default featured image on items that have videos checked.

    function dfi_skip_video ( $dfi_id, $post_id ) {
      if ( has_term('videos', 'portfolio-gallery', $post_id) ) {
        return 0; // invalid id
      return $dfi_id; // the original featured image id
    add_filter( 'dfi_thumbnail_id', 'dfi_skip_video', 10 , 2 );

    This should work. Let me know.

  7. marcsole
    Posted 1 year ago #

    Hi, the code looks good. Where do we have to put this function?

    In the plugin edition

    At the end inside class default_featured_image?


  8. marcsole
    Posted 1 year ago #

    Ok, I find it in functions.php, isn't?

    The code works perfect.

    You are brilliant, thanks!

  9. janw.oostendorp
    Plugin Author

    Posted 1 year ago #

    Hi Marco,

    Forgot to mention this.. You should paste it in your theme functions.php
    If you paste it in my plugin it will be overwritten if it gets an update.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Default featured image
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic