Filter and Search

I don’t believe there’s anything automatic for what you’re looking for, no. I built a similar functionality for sorting products with dimensions, but this was all custom as I did not find anything that suited my needs. You’d need to look into pre_get_posts using $_GET requests.

Query posts by custom fields

I managed to figure it out (finally) after about 12 hours of screwing around. The answer here gave me 98% of the answer, and the rest was simply using the appropriate hooks to modify it for my use and to include the postmeta table.

Selectbox and Searchform and Custom Search Page

Welcome to WPSE! First of all – you cannot have two (or more) elements with the same ID. Second – your select elements lack name attribute and browser doesn’t actually submit anything. Third – you cannot just expect to throw a bunch of selects into the form and expect everything to magically work. In order … Read more

Custom Post Title as search term

If you register the post type with public set to true, the titles will be included automatically. You shouldn’t have to do anything to make this happen. Something as simple as this from the Codex: function codex_custom_init() { $args = array( ‘public’ => true, ‘label’ => ‘Books’ ); register_post_type( ‘book’, $args ); } add_action( ‘init’, … Read more

Trying to put a search page on site

You form action value is wrong. It should be home_url(). WordPress will pick the search template automatically then. The search field has to use the name s: <input type=search name=s> Otherwise WordPress will not recognize the request as a search request. The error happens, because you included the functions.php somehow withut using the automatic by … Read more

How to display articles based on composed tag

Thanks to a similar topic I can do it with : $tag = get_queried_object(); $tag_slug = $tag->slug; Or with this snippet : $current_tag = single_term_title(“”, false); tag_slug = str_replace(‘ ‘, ‘-‘, $current_tag);

Search results load individual post in slide out div

Since you wanted best-practices, methods, advice, here is my take on how you should proceed: First of all, divide the content of your page in two ideal spaces, the list of posts, and the content. Something like this: <nav class=”post-navigation”> <ul> <li> <h2>{Post title}</h2> <p>{Excerpt} [&hellip;]</p> <p><a href=”https://wordpress.stackexchange.com/questions/87312/{post-permalink}”>Read more &rarr;</a></p> </li> </ul> </nav> <section class=”post-content”></section> … Read more

Problem with custom post type search

This is not related only to your custom post_types search. WordPress has a problem on empty search on itself. I use this simple code snippet as workaround: add_filter( ‘request’, ‘my_request_filter’ ); function my_request_filter( $query_vars ) { if( isset( $_GET[‘s’] ) && empty( $_GET[‘s’] ) ) { $query_vars[‘s’] = ” “; } return $query_vars; } You … Read more

How we filter the search base on post-meta tags

Thats because you got the meta_query wrong. Check documentation in Codex Your query should be: $args = array( ‘posts_per_page’ => 30, ‘paged’ => $paged, ‘post_type’ => ‘post’, ‘post_status’ => ‘publish’, ‘meta_query’ => array( array( ‘key’ => ‘post_state’, ‘value’ => $stateName, ‘compare’ => ‘=’ // not necesary by default is “=” ) ) ); Basically you … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)