• Resolved BriceLucas

    (@bricelucas)


    Hi Dave,

    First… thank you so much for such a wonderful plugin. Second, please excuse my poor development capabilities. Here is my issue:

    I am using your plugin, and am having trouble with the search results. I am pulling in a meta-field, however the search is only reading the field value for the first result… then applying that value to all of the results below it.

    What the Results Look Like:

    Post Title One
    Meta-Field One

    Post Title Two
    Meta-Field One

    Post Title Three
    Meta-Field One

    What the results Should Look Like:

    Post Title One
    Meta-Field One

    Post Title Two
    Meta-Field Two

    Post Title Three
    Meta-Field Three

    Any help that you can provide here would be greatly appreciated.

    Thank you,
    Brice

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

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter BriceLucas

    (@bricelucas)

    To add to this, please see below for my code. Any help that someone could provide me here would be very much appreciated.

    daveswordpresslivesearchresults.php code:

    $meta_city = get_post_meta( get_the_ID(), '_museum_city', true );
    $result->post_city = $meta_city;

    daves-wordpress-live-search.js code:

    renderedResult += '<p>' + searchResult.post_city + '</p>';

    Thread Starter BriceLucas

    (@bricelucas)

    Okay, so I fixed this and wanted to update this post just in case someone else had a similar issue. The problem was with how I was getting the ID of the post, it was basically just pulling the ID of the first post only, instead of each result. I had to change “get_the_ID()” to “$result->ID”. Pretty silly how long it took me to realize that. At any rate, here’s the working code if you want to pull in other post-related info into the search results!

    daveswordpresslivesearchresults.php code:

    $meta_city = get_post_meta( $result->ID, '_museum_city', true );
    $result->post_city = $meta_city;

    daves-wordpress-live-search.js code:

    renderedResult += '<p class="search_meta">' + searchResult.post_city + '</p>';

    Thanks for taking the time to explain how you solved your problem. I have an issue when trying to install you solution, I keep getting the undefined message no matter where I put

    $meta_city = get_post_meta( $result->ID, '_museum_city', true );
    $result->post_city = $meta_city;

    Can you please go into more detail. Also I notice that the
    daves-wordpress-live-search.min.js file that actually changes and not the daves-wordpress-live-search.js file.

    Any advice appreciated. Thanks. I am using 3.2. Thanks Search can be seen here

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Plugin: Dave's WordPress Live Search] Field Values Duplicating in Search Results, Making Resul’ is closed to new replies.