Here are a few of the code snippets I use in my functions.php file that could be of benefit to fellow novices:
// Remove thematic_header.
function clear_header() {
remove_all_actions('thematic_header');
}
add_action('init', 'clear_header');
// Replace with custom_header.
function custom_header() {
?>
<?php include($_SERVER['DOCUMENT_ROOT']."/wp-content/themes/you-theme-name/custom-header.php"); ?>
<?php
}
add_action('thematic_aboveheader','custom_header');
// Add favicon for child theme.
function childtheme_favicon() { ?>
<link rel="shortcut icon" href="<?php echo bloginfo('stylesheet_directory') ?>/favicon.png" />
<?php }
add_action('wp_head', 'childtheme_favicon');
The following is useful for adding js/css files and jQuery snippets et al...
// Add additional information to <head>.
function custom_links() { ?>
<?php include($_SERVER['DOCUMENT_ROOT']."/directsponsor/wp-content/themes/directsponsor/custom-head.php"); ?>
<?php }
add_action('wp_head', 'custom_links');
// Conditionally add graphical heading to page content.
// This is useful if you need to apply non-browser-safe font in a graphical manner rather than textually e.g. purely for aesthetics.
function add_content_heading() {
?>
<?php
if ( is_page('home') ){$heading = "home";}
if ( is_page('about') ){$heading = "about";}
if ( is_home() || is_single() || is_archive() || is_category() || is_404() || is_attachment() || is_preview() || is_search() ){$heading = "blog";}
if ( is_page('contact') ){$heading = "contact";} if ( is_archive() ){$heading = "contact";}
if ( is_archive() ){$heading = "archive";}
if ( is_category() ){$heading = "category";}
if ( is_author() ){$heading = "author";}
if ( is_search() ){$heading = "search";}
if ( is_404() ){$heading = "404";}
if ( is_attachment() ){$heading = "attachment";}
?>
<div class="content_heading"><img src="<?php echo bloginfo('stylesheet_directory') ?>/images/heading-<?php echo $heading ?>.png" /></div>
<?php
}
add_action('thematic_abovecontent','add_content_headings');
// Add graphical bottom to page content
function add_content_bottom() {
?>
<div class="content_bottom"></div>
<?php
}
add_action('thematic_belowcontent','add_content_bottom');
// Add graphics before, between and after the primary and secondary asides:
// Add graphical heading for primary aside.
function add_heading_abovemainasides() {
?>
<div class="heading-widget aside main-aside"><img src="<?php echo bloginfo('stylesheet_directory') ?>/images/heading-primary.png" /></div>
<?php
}
add_action('thematic_abovemainasides','add_heading_abovemainasides');
// Graphical bottom for primary aside and then graphical heading for secondary aside.
function add_headingbottom_betweenmainasides() {
?>
<div class="aside main-aside bottom-primary"></div>
<div class="heading-widget aside main-aside"><img src="<?php echo bloginfo('stylesheet_directory') ?>/images/heading-secondary.png" /></div>
<?php
}
add_action('thematic_betweenmainasides','add_headingbottom_betweenmainasides');
// Add custom bottom for secondary aside.
function add_bottom_belowmainasides() {
?>
<div class="aside main-aside bottom-secondary"></div>
<?php
}
add_action('thematic_belowmainasides','add_bottom_belowmainasides');
// Replace navigation above and below with customized navigation i.e. replace the next and previous post links with the words 'next' and 'previous' and instead apply the post title to the tooltip:
// The additional values in the array are used with the following plugin: http://wordpress.org/extend/plugins/ambrosite-nextprevious-post-link-plus/
function add_custom_navigation_above() {
if (is_single()) {
?>
<div id="nav-above" class="navigation">
<div class="nav-previous">
<?php previous_post_link_plus( array(
'order_by' => 'post_date', //default
'order_2nd' => 'post_date', //default
'meta_key' => '',
'loop' => false,
'thumb' => false,
'max_length' => 0,
'format' => '%link',
'link' => 'Previous', //changes the link without changing the tooltip.
'before' => '',
'after' => '',
'in_same_cat' => false,
'ex_cats' => '',
'num_results' => 1,
'echo' => true
) ); ?>
</div>
<div class="nav-next">
<?php next_post_link_plus( array(
'order_by' => 'post_date', //default
'order_2nd' => 'post_date', //default
'meta_key' => '',
'loop' => false,
'thumb' => false,
'max_length' => 0,
'format' => '%link',
'link' => 'Next', //changes the link without changing the tooltip.
'before' => '',
'after' => '',
'in_same_cat' => false,
'ex_cats' => '',
'num_results' => 1,
'echo' => true
) ); ?>
</div>
</div>
<?php
}// end if single.
else {
?>
<div id="nav-above" class="navigation">
<?php if(function_exists('wp_pagenavi')) { ?>
<?php wp_pagenavi(); ?>
<?php } else { ?>
<div class="nav-previous"><?php next_posts_link(__('Older', 'thematic')) ?></div>
<div class="nav-next"><?php previous_posts_link(__('Newer', 'thematic')) ?></div>
<?php } ?>
</div>
<?php
}// end else.
}
add_action('thematic_navigation_above','add_custom_navigation_above');
function add_custom_navigation_below() {
if (is_single()) {
?>
<div id="nav-below" class="navigation">
<div class="nav-previous">
<?php previous_post_link_plus( array(
'order_by' => 'post_date', //default
'order_2nd' => 'post_date', //default
'meta_key' => '',
'loop' => false,
'thumb' => false,
'max_length' => 0,
'format' => '%link',
'link' => 'Previous', //changes the link without changing the tooltip.
'before' => '',
'after' => '',
'in_same_cat' => false,
'ex_cats' => '',
'num_results' => 1,
'echo' => true
) ); ?>
</div>
<div class="nav-next">
<?php next_post_link_plus( array(
'order_by' => 'post_date', //default
'order_2nd' => 'post_date', //default
'meta_key' => '',
'loop' => false,
'thumb' => false,
'max_length' => 0,
'format' => '%link',
'link' => 'Next', //changes the link without changing the tooltip.
'before' => '',
'after' => '',
'in_same_cat' => false,
'ex_cats' => '',
'num_results' => 1,
'echo' => true
) ); ?>
</div>
</div>
<?php
}// end if single.
else {
?>
<div id="nav-below" class="navigation">
<?php if(function_exists('wp_pagenavi')) { ?>
<?php wp_pagenavi(); ?>
<?php } else { ?>
<div class="nav-previous"><?php next_posts_link(__('Older', 'thematic')) ?></div>
<div class="nav-next"><?php previous_posts_link(__('Newer', 'thematic')) ?></div>
<?php } ?>
</div>
<?php
}// end else.
}
add_action('thematic_navigation_below','add_custom_navigation_below');
Hope some/any of this is of use.
The code is probably far from perfect but at the very least it provides a basis of the needs I've had and others might have for functions for the Thematic framework