WordPress.org

Ready to get started?Download WordPress

Forums

Dave's WordPress Live Search
Load image from custom meta field (4 posts)

  1. thaikick
    Member
    Posted 2 years ago #

    Hello, awesome plugin and does exactly what is promised !!!

    I'd like to know if and how it's possible to edit DavesWordPressLiveSearchResults.php to be able to retrieve images from a custom meta field for example "Logo" instead loading the first post image

    Thanks in advance...

    http://wordpress.org/extend/plugins/daves-wordpress-live-search/

  2. Dave Ross
    Member
    Plugin Author

    Posted 2 years ago #

    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.

  3. ljekidex
    Member
    Posted 2 years ago #

    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

  4. Dave Ross
    Member
    Plugin Author

    Posted 2 years ago #

    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;

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic