• Resolved marcsole

    (@marcsole)


    Hello,
    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,
    Marc

    https://www.ads-software.com/plugins/default-featured-image/

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

    (@janwoostendorp)

    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

    Thread Starter marcsole

    (@marcsole)

    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:
    https://dahz.daffyhazan.com/labomba/portfolio-3-col/

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

    Thanks!

    Plugin Author Jan-Willem

    (@janwoostendorp)

    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: https://dahz.daffyhazan.com/labomba/wp-admin/edit-tags.php?taxonomy=category
    Is the edit of gallery: https://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.

    Thread Starter marcsole

    (@marcsole)

    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”.

    Plugin Author Jan-Willem

    (@janwoostendorp)

    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.

    Thread Starter marcsole

    (@marcsole)

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

    In the plugin edition
    /wp-admin/plugin-editor.php?file=default-featured-image/set-default-featured-image.php

    At the end inside class default_featured_image?

    Thanks

    Thread Starter marcsole

    (@marcsole)

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

    The code works perfect.

    You are brilliant, thanks!

    Plugin Author Jan-Willem

    (@janwoostendorp)

    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.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Default image also set in portfolio items’ is closed to new replies.