Created
April 8, 2015 07:28
-
-
Save eri-trabiccolo/ee83f651356dfb6729c3 to your computer and use it in GitHub Desktop.
Replace credits block with a widget area
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Disable customizr-pro credits | |
/* You can achieve the same by unchecking "Enable the footer copyrights and credits" in the Footer options*/ | |
add_action('after_setup_theme', 'disable_pro_credits', 40); | |
function disable_pro_credits(){ | |
if ( method_exists('TC_fc', 'fc_custom_credits') ){ | |
remove_filter( 'tc_credits_display', array(TC_fc::$instance, 'fc_custom_credits') ); | |
} | |
} | |
add_filter( 'tc_default_widgets' , 'add_credits_widget'); | |
function add_credits_widget( $defaults ) { | |
$defaults['credits_widgets'] = array( | |
'name' => __( 'Colophon Credits Widget' , 'customizr' ), | |
'description' => __( 'In the central colophon block' , 'customizr' ) | |
); | |
return $defaults; | |
} | |
add_filter('tc_credits_display' , 'display_my_credits_widget', 20); | |
function display_my_credits_widget() { | |
ob_start(); | |
?> | |
<div class="<?php echo apply_filters( 'tc_colophon_center_block_class', 'span4 credits' ) ?>"> | |
<?php dynamic_sidebar('credits_widgets'); ?> | |
</div> | |
<?php | |
$html = ob_get_contents(); | |
if ( $html ) ob_end_clean(); | |
return $html; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment