Sorry, i write something wrong.
EDIT:
I try use the search query with meta_key and meta_value, but if these parameters are together with search parameter, the search doesn’t work.
Hi,
Can you please post your shortcode? It might help me understand the issue better.
Cheers,
Hi!
<?php $term = $_GET['term']; ?>
<?php echo do_shortcode('[ajax_load_more repeater="repeater5" post_type="produto" posts_per_page="6" meta_key="ref" meta_value="" search="'. $term .'" scroll="false" button_label="Mostrar mais resultados"]'); ?>
meta value is dinamically, like search term.
I would like to search for terms and custom fields, you understand?
Works:
<?php echo do_shortcode('[ajax_load_more post_type="produto" posts_per_page="6" meta_key="ref" meta_value="999" search="'. $term .'" scroll="false" button_label="Mostrar mais resultados"]'); ?>
Doesnt work:
<?php echo do_shortcode(‘[ajax_load_more post_type=”produto” posts_per_page=”6″ meta_key=”ref” meta_value=”‘. $term .'” search=”‘. $term .'” scroll=”false” button_label=”Mostrar mais resultados”]’); ?>
The meta_value should be dinamic.
Have you confirmed that $term is a value?
Yes!
if I remove the search = “” of the shortcode , it works .. the post with custom field appears , but if I leave the search = ” ” and the meta_key , meta_value the same shortcode doesnt work. Not appear any post.
Well that means the search is returning zero results.
Why are you searching for the same term as the meta value?
Asking permission to answer the above question.
I think we have the same problem.
Here’s my shortcode
echo do_shortcode('[ajax_load_more post_type="deal" search="'.$searchresult.'" meta_key="wpcf-town" meta_value="'.$searchresult.'"]');
The reason why i need to put the same value in search term and meta value is because i need to include the custom field in search result. But unfortunately, I can’t do that.
Do you have answer for this problem?
Thanks in advance.
I just tested and it worked for me.
My shortcode : [ajax_load_more post_type="post" meta_key="banner" meta_value="test" search="post"]
The differences are I’m using a standard post type and my search and meta_value were not php variables – I don’t think that should matter though.
What is the result of $searchresult ?