Category In wordpress :Wordpress Hacks

Digg this

What Every Blogger Needs to Know About Categories- You can help your users, improve your SEO, and gain absolute control over your content by implementing your own WordPress category solution!

Conditional Tags can be used in your Template files to change what content is displayed and how that content is displayed on a particular page depending on what conditions that page matches.



Styling different categories: If you want to use certain stylesheet for specific category, all you have to do is add the code below to the tag in your index.php file.

<?php if ( is_category('15') ) {
<link rel="stylesheet" href="<?php bloginfo('template_url'); ?>/cat-15.css"
type="text/css" media="screen" />;
<?php } else { ?>
<link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>"
type="text/css" media="screen" />
<?php } ?>

Dynamic file content If you want to include a file that will only appear on the home page, Place this code in the index.php:
<?php if ( is_home() ) { include ('filename.php'); } ?>

Better SEO Titles for your pages
<?php
if (is_home()) { echo bloginfo('name'); }
elseif (is_404()) { bloginfo('name'); echo ' - Oops, this is a 404 page'; }
else if ( is_search() ) { bloginfo('name'); echo (' - Search Results');}
else { bloginfo('name'); echo (' - '); wp_title(''); }
?>

Related Posts by Categories



Widget by Scrapur | Scrap Book

0 comments: