Skip to content

Instantly share code, notes, and snippets.

@AmeliaBriscoe
Created August 21, 2012 18:01
Show Gist options
  • Save AmeliaBriscoe/3417947 to your computer and use it in GitHub Desktop.
Save AmeliaBriscoe/3417947 to your computer and use it in GitHub Desktop.
Thesis Child Theme Template
<?php
if (! defined('ABSPATH'))
die('Please do not directly access this file');
include_once(TEMPLATEPATH . '/functions.php');
class ten0nine_child_theme extends thesis_custom_loop {
public function __construct() {
// run the parent constructor so we can access the thesis custom loop api
parent::__construct();
// run the main init
add_action('init', array($this, 'init'));
}
public function init() {
// actions and filters that will run on init. you could put other things here if you need.
$this->actions();
$this->filters();
$this->sidebars();
}
public function actions() {
// add and remove actions here
// this will force thesis to generate CSS when the user switches to the child
add_action('after_switch_theme', 'thesis_generate_css');
//Remove Attribution and add site attribution
remove_action('thesis_hook_footer', 'thesis_attribution');
add_action('thesis_hook_footer', array($this,'ten0nine_footer'));
//custom 404 page
add_action('thesis_hook_404_content',array($this,'ten0nine_404_content'));
remove_action('thesis_hook_404_content', 'thesis_404_content');
add_action('thesis_hook_404_title',array($this,'ten0nine_404_title'));
remove_action('thesis_hook_404_title', 'thesis_404_title');
//add time to hentry for google snippets
add_action('thesis_hook_byline_item', array($this,'add_to_byline'));
}
public function filters() {
// add and remove filters here
//No Sidebars on main page
add_filter('thesis_show_sidebars', array($this,'no_sidebars'));
//remove header and footer from the specific pages
add_filter('thesis_show_header', array($this,'custom_remove_defaults'));
add_filter('thesis_show_footer', array($this,'custom_remove_defaults'));
}
//Add sidebars to footer for later use
public function sidebars() {
if ( function_exists('register_sidebar') )
register_sidebar(array(
'name' => 'Footer Widgets Left',
'before_widget' => '<li class="widget %2$s" id="%1$s">',
'after_widget' => '</li>',
'before_title' => '<h3>',
'after_title' => '</h3>'
));
if ( function_exists('register_sidebar') )
register_sidebar(array(
'name' => 'Footer Widgets Middle',
'before_widget' => '<li class="widget %2$s" id="%1$s">',
'after_widget' => '</li>',
'before_title' => '<h3>',
'after_title' => '</h3>'
));
if ( function_exists('register_sidebar') )
register_sidebar(array(
'name' => 'Footer Widgets Right',
'before_widget' => '<li class="widget %2$s" id="%1$s">',
'after_widget' => '</li>',
'before_title' => '<h3>',
'after_title' => '</h3>'
));
}
public function front() {
thesis_loop::front(); // remove this line and enter your custom loop
}
public function page() {
thesis_loop::page(); // remove this line and enter your custom loop
}
public function archive() {
thesis_loop::archive(); // remove this line and enter your custom loop
}
//No Sidebars on main page
public function no_sidebars() {
if (is_front_page()){
return false;
}else{
return true;
}
}
//Remove Attribution and add site attribution
public function ten0nine_footer(){
$time = get_the_time('Y'); ?>
<p class="myFooter">Copyright &copy <?php echo $time; ?>
<a href="<?php bloginfo('url'); ?>"><?php bloginfo('name'); ?></a>. All rights reserved.</p>
<p class="myFooter">
<a href="http://www.thesisvideotutorials.com/thesis/" target="_blank">Thesis Theme for WordPress</a>: Options Galore and a Helpful Support Community</p>
<?php
}
public function add_to_byline() {
if(!is_page()){
echo '<abbr class="updated" style="display:none">'.get_the_time('', $post->ID).'</abbr>';
}
}
public function ten0nine_404_title() {
?>
<h1>Ruh-Roh!</h1>
<?php
}
//custom 404 page
public function ten0nine_404_content() {
}
public function custom_remove_defaults($content) {
global $post;
if (is_page()) {
return false;
}else{
return true;
}
}
}
new ten0nine_child_theme;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment