Wordpress Tips

Wednesday, September 3rd, 2008 @ 6:43 pm | wordpress

An ongoing post of wordpress snippets

Template tags

PHP

Prints template url
<?php bloginfo('template_url'); ?>

If Home condition
<?php if (is_home()) { ?>
Whatever goes here
<?php } ?>

If page or post or category
<?php if (is_page() || is_single() || is_category()) { ?>
Whatever goes here
<?php } ?>

http://codex.wordpress.org/Conditional_Tags

Highlight Navigation
<?php
if ( is_page('About') ) { $current = 'about'; }
elseif ( is_page('Hire') ) { $current = 'hire'; }
elseif ( is_page('Links') ) { $current = 'links'; }
?>
<style type="text/css">
#<?php echo $current; ?> {
color: #ff4cad;
}
</style>

http://codex.wordpress.org/Dynamic_Menu_Highlighting