WordPress.org

Support

Support » Plugins and Hacks » Dave's WordPress Live Search » Load image from custom meta field

Load image from custom meta field

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Dave Ross

    @csixty4

    Version 3.0 introduced some hooks for manipulating the results. You can use the dwls_attachment_thumbnail filter to change what’s put in the thumbnail field. Off the top of my head, I think you just need to return the URL of an image you want to use.

    Hi Dave, I like this plugin very much and I am trying to make it work thumbnails this filter adding something like this in function.php (on the end of file)

    add_filter('dwls_attachment_thumbnail', 'dwls_test_attachment_thumbnail');
    function dwls_test_attachment_thumbnail($foo) {
    
       get_the_post_thumbnail ($id, 'thumbnail', array('class' => 'photo main_photo'));
    
       echo get_the_post_thumbnail();
    
    }

    This is not working , so can you please give me advice about this ?
    Thanks

    Plugin Author Dave Ross

    @csixty4

    Sorry for not getting back to you sooner. A filter needs to return the modified content. So in your case:

    $foo = get_the_post_thumbnail();
    return $foo;
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Load image from custom meta field’ is closed to new replies.
Skip to toolbar