WordPress.org

Ready to get started?Download WordPress

Forums

Promotion Slider
Custom thumbnail images (31 posts)

  1. prologuemedia
    Member
    Posted 1 year ago #

    How would I use custom thumbnail images with the sliders?

    http://wordpress.org/extend/plugins/promotion-slider/

  2. Micah Wood
    Member
    Plugin Author

    Posted 1 year ago #

    What do you mean by custom thumbnail images? If you could be more specific it would be helpful. I'm not clear on what you are trying to do.

  3. prologuemedia
    Member
    Posted 1 year ago #

    Sorry about that. I am wanting to use thumbnails for the navigation that I generate and not those that WordPress creates. Does that make sense?

  4. Micah Wood
    Member
    Plugin Author

    Posted 1 year ago #

    Yes. So you can use your own thumbnail images, but you have to do that using the WordPress 'post_thumbnail_html' filter. Here is an example usage: http://trepmal.com/filter_hook/post_thumbnail_html/

  5. prologuemedia
    Member
    Posted 1 year ago #

    It looks like a piece of code to remove titles. Am I reading that correctly?

  6. Micah Wood
    Member
    Plugin Author

    Posted 1 year ago #

    That particular code is removing titles, but the filter itself can be used for a variety of purposes.

  7. prologuemedia
    Member
    Posted 1 year ago #

    Not sure where to begin with that direction. The filter is added where?

  8. Micah Wood
    Member
    Plugin Author

    Posted 1 year ago #

    I'm not sure where you are going to fetch your own thumbnail from, but the code would look something like this:

    add_filter( 'post_thumbnail_html', 'remove_feat_img_title' );
    function remove_feat_img_title( $img ) {
        $img = // Fetch my image HTML
        return $img;
    }

    Just add this code to your active theme's functions.php file.

  9. prologuemedia
    Member
    Posted 1 year ago #

    Thanks for the guidance. I am going to chew on this and see if I can get a vision.

  10. brocoms
    Member
    Posted 1 year ago #

    Hello Micah,

    I am sort of creating the same function as his. How would I create a custom image thumbnail in promotion slider that will set its thumbnail from another image or create a field that will set thumbnail image of the slider instead of pulling the featured-image as thumbnail? Is this possible?

    Thanks in advance!

  11. Micah Wood
    Member
    Plugin Author

    Posted 1 year ago #

    @brocoms,

    I have code already that will do this, but what I have isn't a copy / paste solution. Click on my WordPress profile and follow the links to get in touch with me. I would be glad to share what I have.

  12. brocoms
    Member
    Posted 1 year ago #

    Thanks Mica!

    I have been waiting for your reply. Glad you have already coded that feature and it is very appreciated if you have that in promotion settings. But as of now I have managed to create a custom field with image as a thumbnail for slider using advance custom field plugin in creating promotion but what I am troubling in was - even if I attached different images on every post, it still get the same image on the thumbnail.

    I appreciate your reply and I hope you can help me achieve this. The only problem by now is that custom image thumbnail query the same image.

    Thanks in advance! I know this plugin is very helpful.

  13. Micah Wood
    Member
    Plugin Author

    Posted 1 year ago #

    For those who are trying to do similar things and already have the attachment id for your custom thumbnail stored in post meta, here is what you need to swap out the thumbnails used in the navigation:

    add_filter( 'post_thumbnail_html', 'my_post_thumbnail_html', 10, 5 );
    function my_post_thumbnail_html( $html, $post_id, $post_thumbnail_id, $size, $attr ) {
    	if( 'ps_promotion' == get_post_type( $post_id ) && 'thumbnail' == $size ) {
    		if( $thumb_id = get_post_meta( $post_id, '_ps_custom_thumbnail', true ) ) {
    			$html = wp_get_attachment_image( $thumb_id );
    		}
    	}
    	return $html;
    }

    Obviously, you may need to change the name of the meta key.

  14. brocoms
    Member
    Posted 1 year ago #

    Hello Micah,

    Since a couple of weeks I have been away from the pc. But anyways, thanks for the code snippet for the custom thumbnail. Very much appreciated.. :)
    I have been integrating this unto functions.php on promotion slider plugin but I was unlucky, same image were visible by the thumbnail. I think I missed some details on the code to work it properly.

    Thanks Mica! :)

  15. brocoms
    Member
    Posted 1 year ago #

    I am able to integrate it. It's very unlucky, were will I swap this on functions.php?

    I swap it with the functions--> function promoslider_thumb_nav($values)

    and change the name of the meta key but no luck.

    Please Help! I have been doing this for a couple of weeks now but still not yet resolved.

    Thank you very much for the Help...

  16. brocoms
    Member
    Posted 1 year ago #

    Sorry got two upload...

  17. Bikash Nayak
    Member
    Posted 1 year ago #

    Hi,

    It did not show any option to load thumbnail image in my case. Can you confirm me how and where I will put above code as a result it will work.

    Thanks

  18. Micah Wood
    Member
    Plugin Author

    Posted 1 year ago #

    @bikash-nayak,

    Sorry, the code I shared previously isn't going to give you an option to load a thumbnail image. It only works in the case that you already have an image you would like to use and a way to reference it in the code... even then you will have to tweak it to work for your use case.

  19. Bikash Nayak
    Member
    Posted 1 year ago #

    Hello,

    Really I need different thumbnail image for slider navigation. Please suggest any idea.

    Thanks

  20. Micah Wood
    Member
    Plugin Author

    Posted 1 year ago #

    Like I mentioned before, I have written a plugin that will do custom thumbnail images... but I can't paste the code here.

  21. brocoms
    Member
    Posted 1 year ago #

    Is that what you mentioned you have already the code for custom thumbnail images already added on the new promotion slider version plugin?

  22. Micah Wood
    Member
    Plugin Author

    Posted 1 year ago #

    @brocoms No, it is a separate plugin.

  23. brocoms
    Member
    Posted 1 year ago #

    ahh.. okay.. what's the name of that plugin? can we download it and integrate it on promotion slider? so that we can have full functional promotion slider with different image as thumbnail?

    Thanks Mica.. I am very much excited to implement it and this would really really help me alot. :)

  24. Micah Wood
    Member
    Plugin Author

    Posted 1 year ago #

    @brocoms You would have to get a hold of me directly so I can send it to you. I haven't released it yet.

  25. brocoms
    Member
    Posted 1 year ago #

    Okay. I will just wait :) ... can't wait to implement that.. very very much thanks for that one.. I became your fan now.. :)

  26. Bikash Nayak
    Member
    Posted 1 year ago #

    @Micah Wood I got custom-thumbnail image in promotional slider but only problem is to slide the thumbnail image when it more than 12 slider according to its width, hoping you will help with this...

  27. itssri
    Member
    Posted 1 year ago #

    The Add Promotion or Edit Promotion page doesn't have the custom fields option. So, where do I specify the media attachment ID for the thumbnail for that promotion?

  28. itssri
    Member
    Posted 1 year ago #

    @Micah Wood
    @Bikash Nayak

    Any hint will be greatly appreciated.

    Thank you.

  29. Bikash Nayak
    Member
    Posted 1 year ago #

    Hi @itssri! I Will look through the custom thumb image soon as I get free...

  30. Micah Wood
    Member
    Plugin Author

    Posted 1 year ago #

    @itssri

    You can easily enable the custom fields on any post type by using the add_post_type_support() function.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic