Search by tag name and category

use this function put in function.php file for cat=22 filter change your cat id for you mind function my_search_form( $form ) { $form = ‘<form role=”search” method=”get” id=”searchform” action=”‘ . home_url( “https://wordpress.stackexchange.com/” ) . ‘” > <div><label class=”screen-reader-text” for=”s”>’ . __(‘Search for:’) . ‘</label> <input type=”text” value=”‘ . get_search_query() . ‘” name=”s” id=”s” /> <input … Read more

Refine custom posts by author

Three steps need to be followed to accomplish it. 1. Add rewrite rules add_action(‘generate_rewrite_rules’, ‘author_cpt_add_rewrite_rules’); function author_cpt_add_rewrite_rules( $wp_rewrite ) { $new_rules = array( ‘author/(.+)/(.+)’ => ‘index.php?author=”.$wp_rewrite->preg_index(1) . “&post_type=” .$wp_rewrite->preg_index(2) ); //​ Add the new rewrite rule into the top of the global rules array $wp_rewrite->rules = $new_rules + $wp_rewrite->rules; } 2. Redirect to specific templates … Read more

how to show a category from a CPT?

WP_Query is the solution to your problem. Go through the available parameters. Just add a query and a loop in your page template and you are good to go. Ex. $args = array( ‘category_name’ => ‘winter’, ‘orderby’ => ‘rand’, ‘posts_per_page’ => 10 ); $query = new WP_Query( $args ); The loop starts here: <?php if … Read more