Get a particular header, footer, or sidebar of wordpress
January 4, 2009
Since WordPress 2.7, it is easier to choose which header, footer or sidebar file you want to include on your theme. The following code will check if the reader is on the “WordPress” category. If yes, header-wordpress.php will be inclued, otherwise the default header will be used: <?php if is_category('WordPress') { get_header('wordpress'); } else { get_header(); } ?> You can also use that new functionality with footers and sidebars: <?php get_footer('myfooter'); ?> will include footer-myfooter.php <?php... [Read the full story]
Integrate files on your wordpress blog header
December 7, 2008
When developping a WordPress plugin or widget, you sometimes need to add files as such as CSS or Javascript in the theme header. But how to do it when you can access the theme file? Here’s a simple way to add anything in the blog header without editing header.php. The principe is simple: You first got top create a function that will simply print the required files. Then, you got to hook it to the wp_head() WordPress function, by using the add_action() function. function GetLastPostName_head() { echo '<script type="text/javascript"... [Read the full story]
Display a random header image
November 2, 2008
A lot of WordPress users seems to be very interested by being able to display a random header image. we will use the php rand() function, which allows us to get a random number between 1 and 99 (in this exemple), to display a random header on each post or page. If the random number is less than or equals to 33, the first header image will be displayed. Less than or equals to 66, the second header image will be shown, and same for the last one, which will be displayed only if our random number and less than or equals to 99. Paste... [Read the full story]
Use multiple custom headers on a WordPress theme
October 24, 2008
Do you ever wanted to have multiple headers on your WordPress blog? If yes, here’s a clear and concise tutorial that will help you to get themost out of your blog headers! The first thing to do is to create header files. Create as many different headers as you want. In this exemple, I have created 3 custom headers from my theme default file header.php, names headercontact.php, headergallery.php and headerdefault.php. By using the php include() function and WordPress conditional tags, we can define custom headers easily. Replace... [Read the full story]




















