• Hi Ajay,

    We’ve implemented a new meta box in the WordPress admin area to allow user to upload a featured image then displayed in the post and a separate thumbnail for article listings elsewhere.

    Is there anyway we can manipulate the plugin to automatically pull in this new thumbnail, rather than the featured image?

    Thanks!

    Here’s a snippet of the function used to implement out thumbnail meta box:

    /* Multiple Post thumbanails */

    if (class_exists(‘MultiPostThumbnails’)) {

    new MultiPostThumbnails(array(

    ‘label’ => ‘Thumbnail’,

    ‘id’ => ‘secondary-image’,

    ‘post_type’ => ‘post’

    ) );

    }

    https://wordpress.org/plugins/contextual-related-posts/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author WebberZone

    (@webberzone)

    Do you know if the thumbnail URL that you use here is saved in a specific meta field?

    If so, instead of using “post-image” you can change this in the plugin settings and that will automatically get prioritised.

    Thread Starter JPlatts

    (@jplatts)

    I’ve added in the meta field name highlighted on the link below, but it doesn’t appear to be working. Any ideas?

    http://createinleeds.com/jamie/post-thumbnail.jpg

    Thanks

    If you don’t store the url in a meta field – for example, if you use the MultiPostThumbnails which stores the attachment ID in a meta field – you can use the crp_thumb_url filter, eg:

    function my_filter_crp_thumbnail_url($url, $width, $height, $post) {
        //return a custom url or $url
    }
    add_filter('crp_thumb_url', 'my_filter_crp_thumbnail', 10, 4);
    Plugin Author WebberZone

    (@webberzone)

    x2764tech, thanks for confirming this.

    JPlatts, I think you might need to use:

    function my_filter_crp_thumbnail_url($url, $width, $height, $post) {
        //return a custom url or $url
        return MultiPostThumbnails::get_post_thumbnail_url( get_post_type( $post ), 'secondary-image');
    
    }
    add_filter('crp_thumb_url', 'my_filter_crp_thumbnail', 10, 4);
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Automatically use secondary image, not featured’ is closed to new replies.