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

WP overwrites my setup_postdata() setup

Should all CPT “lecture” posts use this template? If so, just rename your file single-lecture.php and place it in the root directory of your theme, and WP will automatically use it due to its template hierarchy. If instead you’re trying to assign this custom template to hand-picked pages, wherever you register your post type, add … Read more

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