How to use another file instead of home.php

You could filter home_template, check for the presence whatever $_GET var is reliably set for each of those requests, and load a different template for those cases. function wpd_home_template( $home_template=”” ){ if( isset( $_GET[‘search_type’] ) ){ $home_template = locate_template( ‘homesearch.php’, false ); } return $home_template; } add_filter( ‘home_template’, ‘wpd_home_template’ ); EDIT- fixed incorrect var test.

Removing calls to noindex() and wp_no_robots()

Why you are changing the code for these thing which are able done via dashboard.? WordPress comes with a built-in feature that allows you to instruct search engines not to index your site. All you need to do is visit Settings » Reading and check the box next to Search Engine Visibility option. When this … Read more

Sending email for the custom form in WordPress

The easy way would install this plugin – https://da.wordpress.org/plugins/contact-form-7/ – It’s super easy to work with, and it will do what you want 🙂 If you don’t want to use a plugin, then you would just code a contact form with html and php. PHP: <?php $firstname = $_POST[‘firstname’]; $lastname = $_POST[‘lastname’]; $from = $_POST[’email’]; … Read more

Pagination issue with tag.php

Never re-do the main query. Hook into pre_get_posts and change it. The following needs to go in your functions.php (putting in the template will mean it runs too late): add_action( ‘pre_get_posts’, function ( $wp_query ) { if ( $wp_query->is_main_query() && $wp_query->is_tag() ) { $wp_query->set( ‘posts_per_page’, 20 ); $wp_query->set( ‘post_type’, [ ‘pavilion’, ‘post’, ‘catalog’, ‘tenders’, ‘services’, … Read more

Add stylesheet per layout

If you are talking about a page template, then you can do a conditional check with is_page_template() and includethe CSS in the header with wp_enqueue_syle(). Something like this: function themename_include_page_specific_css() { if ( is_page_template( ‘template-name.php’ ) : wp_enqueue_style( ‘themename_page_specific_css’, get_template_directory_uri() . ‘/page-specific-style.css’ ); endif; } add_action( ‘wp_enqueue_scripts’, ‘themename_include_page_specific_css’ ); Keep in mind, that the parameter … Read more

Assign Specific Template for Custom Post slug

Looking at the template hierarchy it does not look like there is a way to do this automatically, by post type and taxonomy. But, you could use a page template which you would need to select on every custom post where you want to use the different template. In the code where you define the … Read more