Build A Custom SQL Query for WordPress Search

A possible solution is to use the pre_get_posts action: add_action(‘pre_get_posts’, ‘custom_search_query’); function custom_search_query($query) { // run only if is a search query and if the search string is not empty if($query->is_search() && $query->is_main_query() && get_query_var(‘s’, false)) { // here you can use your custom query having ‘get_query_var(‘s’, false)’ as $Search string //”SELECT SQL_CALC_FOUND_ROWS *………. // … Read more

How to create a clickable latest posts list?

I believe what you need is the wp_list_categories() function. You would need to do something like this; wp_list_categories( array( ‘orderby’ => ‘name’, ‘show_count’ => true, ‘exclude’ => array( 10 ) ) ); This will list all the available post categories ordered by title. You can have a look at the docs for this to find … Read more