Created
April 13, 2015 17:34
-
-
Save eri-trabiccolo/0c37f03cea3ced0d0b4f to your computer and use it in GitHub Desktop.
Replace credits block with a widget area, move credits right
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
| 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' ) ?>"> | |
| <?php dynamic_sidebar('credits_widgets'); ?> | |
| </div> | |
| <?php | |
| $html = ob_get_contents(); | |
| if ( $html ) ob_end_clean(); | |
| return $html; | |
| } | |
| // replace back to top with credits | |
| add_action('after_setup_theme', 'disable_pro_credits', 40); | |
| function disable_pro_credits(){ | |
| if ( ! method_exists('TC_fc', 'fc_custom_credits') ) | |
| return; | |
| remove_filter( 'tc_credits_display', array(TC_fc::$instance, 'fc_custom_credits') ); | |
| add_filter('tc_colophon_right_block', array(TC_fc::$instance, 'fc_custom_credits') ); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment