Viewing 15 replies - 1 through 15 (of 30 total)
  • Plugin Author Micah Wood

    (@woodent)

    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.

    Thread Starter prologuemedia

    (@prologuemedia)

    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?

    Plugin Author Micah Wood

    (@woodent)

    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: https://trepmal.com/filter_hook/post_thumbnail_html/

    Thread Starter prologuemedia

    (@prologuemedia)

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

    Plugin Author Micah Wood

    (@woodent)

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

    Thread Starter prologuemedia

    (@prologuemedia)

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

    Plugin Author Micah Wood

    (@woodent)

    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.

    Thread Starter prologuemedia

    (@prologuemedia)

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

    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!

    Plugin Author Micah Wood

    (@woodent)

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

    brocoms

    (@brocoms)

    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.

    Plugin Author Micah Wood

    (@woodent)

    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.

    brocoms

    (@brocoms)

    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! ??

    brocoms

    (@brocoms)

    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…

    brocoms

    (@brocoms)

    Sorry got two upload…

Viewing 15 replies - 1 through 15 (of 30 total)
  • The topic ‘[Plugin: Promotion Slider] Custom thumbnail images’ is closed to new replies.