search results to show individual ACF fields from inside custom posts
search results to show individual ACF fields from inside custom posts
search results to show individual ACF fields from inside custom posts
I ended up using a simple meta_query: $args = [ ‘post_status’ => ‘publish’, ‘post_type’ => $post_type, ‘orderby’ => ‘title’, ‘order’ => ‘ASC’, ‘meta_query’ => array( ‘relation’ => ‘OR’, array( ‘key’ => ‘my_acf_field’, ‘value’ => $search_term, ‘compare’ => ‘LIKE’ ), ) ]; $query = new WP_Query($args);
Modify wordpress search to search only pages and load matched page not search results
Finally I found the cause of this issue. It was simply because of Polylang plugin. As the plugin adds a taxonomy related to the language of the website to all posts, it adds a LEFT JOIN statement to the search query with a condition WHERE 1=1 AND post has that taxonomy id. As I didn’t … Read more
add this code in your search.php <?php $show_pagination = true; if($wp_query->post_count < 0) { $show_pagination = false; } ?> <?php if($show_pagination){ ?> <!– The pagination component –> <div class=”container”> <div class=”row mt-3″> <?php understrap_pagination(); ?> </div> </div> <?php } ?> So your search.php look like this : <div class=”wrapper” id=”search-wrapper”> <div class=”<?php echo esc_attr( $container … Read more
It seems that you use a plugin to display this form. If you use a plugin and you can’t modify plugin scripts, I advice you to use CSS. You can add this line to style.css of your theme (Go to Appearance > theme editor) : .iw-search-add-advanced {display:none!important;} /*not display advance button */ .iw-fields-advanced {display:block!important;} /* … Read more
It turns out the use of a variable called $args within ‘searchform.php’ causes the searchform to output nothing.
Search button click sends to single-custom_post_type instead staying at the same page
I had the same issue and I did this and it worked: Add 3 options and go to your database. Search for any of those options, when you find them, go to the table it is in. You won’t be able to see the options but just the field name. Export the table you found … Read more
I’m not so professional in this but I have a solution you can try. You can create custom page templates in WordPress and place your form code in that template and in another template create your result page and pass the query using POST method to the result page template. Then with php you can … Read more