Adding style to single page or post

In this post I will explain on adding separate style-sheet to single post or page.  For this we need to use a hook called  template_redirect. The template_redirect action hook is an important hook because it’s the point where WordPress figures which page a user is viewing. It is executed just before the theme template is loaded for particular page view. It is fired only on the front end of the site and not in the administration area. This is a preferred hook to use when you need to load code only for specific page views.

This example loads a style-sheet  only for a singular post view.

<?php
add_action( 'template_redirect', 'wptutz_singe_post_css' );
function wptutz_singe_post_css() {
if ( is_singular('post') ) {
wp_enqueue_style('wptutz-single-post','example.css',false,0.1,'screen');
}
} ?>

WordPress performance tuning in nutshell

First of all I am not a professional in making WordPress sites super fast. The things I discuss in this post are mere experience I had, while I worked on a client project. Ok here is  the situation. You somehow managed to get a client project and … [Continue reading]

Add and display custom profile fields using gravity forms

Add custom profile field

When it comes to form handling in WordPress,  Gravity forms stands ahead of all other plugins. Even it is a premium plugin, its worth the cost. It satisfies an absolute beginner by its users-friendly interface, as well as a developer by various … [Continue reading]

WordPress creating and rearranging custom navigation menu

After the release of WordPress 3.0 , The menu system turned very much easy for customization,  but  still we are in need of custom navigation menus for certain occasions. In this tutorial, I will explain on creating custom navigation menu and … [Continue reading]

Install WordPress in local host using WAMP

phpmyadmin

In this tutorial, I will explain you how to install WordPress in your local host on Windows operating system. PHP websites unlike a static HTML website, runs only on a server. WordPress was built using php as a server side scripting language. In … [Continue reading]