WordPress Theme Tweaks

http://crshare.com/2009/01/wordpress-theme-tweaks/#more-3566

 I have noticed that there is no such thing  as perfect suitable WordPress theme for your needs. No matter whattheme  you'll be downloading you will want to change something in it. To add a few extra options may be tricky sometimes but here are some WordPress theme hacks what will make your life easier.

Dynamic Content to homepage

If you want to include a specific file in your homepage you can use this code:

<?php if ( is_home() ) { include ('yourfile.php'); } ?>

where 'yourfile.php' is the file that you want to include in the homepage


Use different post templates for different categories


Lets say you have a video, product or author category or any other where you want to have a different layout from your blog category see the categories ID's, build single.php files with different layouts for your categories and rename each one according to the category ID like this single.1php, single2.php where 1 and 2 is the category name in our example and add this code in the base single.php file:

<?php
$post = $wp_query- >post;

if ( in_category('1′) ) {
include(TEMPLATEPATH . '/single1.php');

} elseif ( in_category('2′) ) {
include(TEMPLATEPATH . '/single2.php');

} else {
include(TEMPLATEPATH . '/single.php');

}
? >

In the code insert the category ID in "in_category('2′)".


more tips onthe Link

0 comments:

Post a Comment