Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- add_filter('tc_global_layout', 'my_custom_layout' );
- function my_custom_layout( $layout ) {
- $my_layout = array(
- 'r' => array ('content' => 'span8' , 'sidebar' => 'span4'),//sidebar on the right
- 'l' => array ('content' => 'span8' , 'sidebar' => 'span4'),//sidebar on the left
- 'b' => array ('content' => 'span4' , 'sidebar' => 'span4'),//both : two sidebars
- 'f' => array ('content' => 'span12' , 'sidebar' => false),//full width : no sidebars
- );
- //sets new values for content and sidebar (checks if there are new values to set first)
- foreach ($layout as $key => $value) {
- $layout[$key]['content'] = isset( $my_layout[$key]['content']) ? $my_layout[$key]['content'] : $layout_choices[$key]['content'];
- $layout[$key]['sidebar'] = isset( $my_layout[$key]['sidebar']) ? $my_layout[$key]['sidebar'] : $layout_choices[$key]['sidebar'];
- }
- return $layout;
- }
- add_action( 'wp_enqueue_scripts', 'my_google_font' );
- function my_google_font() {
- wp_enqueue_style( $handle = 'my-google-font', $src = 'http://fonts.googleapis.com/css?family=Open+Sans:400italic,700italic,700,400', $deps = array(), $ver = null, $media = null );
- }
- add_filter( 'tc_meta_utility_text', 'my_meta_texts' );
- function my_meta_texts() {
- if ( false != get_the_tags() ) {
- $my_metas = __( '<span class="by-author"> By %4$s</span> on %3$s<br />Categories: %1$s | Tags: %2$s' , 'customizr' );
- } elseif ( false != get_the_category() ) {
- $my_metas = __( '<span class="by-author"> By %4$s</span> on %3$s<br />Categories: %1$s' , 'customizr' );
- } else {
- $my_metas = __( '<span class="by-author"> By %4$s</span> on %3$s' , 'customizr' );
- }
- return $my_metas;
- }
- add_action('wp_head','my_analytics',1,20);
- function my_analytics() {
- ?>
- <script>
- (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
- (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
- m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
- })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
- ga('create', 'UA-332083-1', 'auto');
- ga('send', 'pageview');
- </script>
- <?php
- }
- // Adds a widget area.
- if (function_exists('register_sidebar')) {
- register_sidebar(array(
- 'name' => 'Extra Header Widget Area',
- 'id' => 'extra-widget-area',
- 'description' => 'Extra widget area after the header',
- 'before_widget' => '<div class="widget my-extra-widget">',
- 'after_widget' => '</div>',
- 'before_title' => '<h2>',
- 'after_title' => '</h2>'
- ));
- }
- // Place the widget area after the header
- add_action ('__after_header', 'add_my_widget_area', 1);
- function add_my_widget_area() {
- if (function_exists('dynamic_sidebar')) {
- dynamic_sidebar('Extra Header Widget Area');
- }
- }
- // As of 3.1.10, Customizr doesn't output an html5 form.
- add_theme_support( 'html5', array( 'search-form' ) );
- add_filter('wp_nav_menu_items', 'add_search_form_to_menu', 10, 2);
- function add_search_form_to_menu($items, $args) {
- // If this isn't the main navbar menu, do nothing
- if( !($args->theme_location == 'main') )
- return $items;
- // On main menu: put styling around search and append it to the menu items
- return $items . '<li class="my-nav-menu-search">' . get_search_form(false) . '</li>';
- }
- // Jetpack Related Files Headline Change
- function jetpackme_related_posts_headline( $headline ) {
- $headline = sprintf(
- '<h3 class="jp-relatedposts-headline" style="font-size:1.5em;"><em>%s</em></h3>',
- esc_html( 'Related Articles' )
- );
- return $headline;
- }
- add_filter( 'jetpack_relatedposts_filter_headline', 'jetpackme_related_posts_headline' );
- add_filter( 'tc_post_author_metas_html', 'my_author_metas_html', 20, 2);
- function my_author_metas_html( $html, $_auth = '' ){
- if ( empty($_auth) )
- return $_html;
- return sprintf( '<span class="by-author">%s %s</span>' , __('By' , 'customizr'), $_auth );
- }
- add_filter( 'tc_post_tax_metas_html', 'my_tax_metas_html', 20, 2);
- function my_tax_metas_html( $html, $_tax = array() ){
- if ( empty($_tax) )
- return $_html;
- //extract "_show_cats" , "_show_tags" , "cat_list", "tag_list"
- extract($_tax);
- $cat_list = ! empty($cat_list) && $_show_cats ? sprintf( '<br />%s %s' , 'Category:' , $cat_list ) : '';
- $tag_list = ! empty($tag_list) && $_show_tags ? sprintf( '%s %s %s' , ! empty( $cat_list) ? ' |' : '', 'Tags: ' , $tag_list ) : '';
- return sprintf( '%s%s' , $cat_list, $tag_list );
- }
- add_filter( 'tc_set_metas_content', 'my_metas_content', 20, 2);
- function my_metas_content( $_html, $_parts){
- if ( empty($_parts) )
- return $_html;
- //extract $_tax_text , $_date_text, $_author_text, $_update_text
- extract($_parts);
- return sprintf( '%3$s %1$s %2$s %4$s' , $_date_text, $_tax_text , $_author_text, $_update_text );
- }
- add_filter( 'tc_grid_col_layout_map' , function( $_map ) {
- return array_merge( $_map, array( 'span8' => '3' ) );
- });
- //Change Footer Credits
- add_filter('tc_credits_display', 'my_custom_credits');
- function my_custom_credits(){
- $credits = '';
- $newline_credits = '';
- return '
- <div class="span4 credits">
- <p> · © '.esc_attr( date( 'Y' ) ).' <a href="'.esc_url( home_url() ).'" title="'.esc_attr(get_bloginfo()).'" rel="bookmark">'.esc_attr(get_bloginfo()).'</a> · '.($credits ? $credits : 'Customized by <a href="http://www.johnrothra.com/">John L. Rothra</a>').' ·'.($newline_credits ? '<br />· '.$newline_credits.' ·' : '').'</p> </div>';
- }
- function jptweak_remove_share() {
- remove_filter( 'the_content', 'sharing_display',19 );
- remove_filter( 'the_excerpt', 'sharing_display',19 );
- if ( class_exists( 'Jetpack_Likes' ) ) {
- remove_filter( 'the_content', array( Jetpack_Likes::init(), 'post_likes' ), 30, 1 );
- }
- }
- add_action( 'loop_start', 'jptweak_remove_share' );
- function jeherve_early_sharing_buttons( $content ) {
- $sharing = '';
- if ( function_exists( 'sharing_display' ) ) {
- $sharing = sharing_display( '', false );
- }
- if ( class_exists( 'Jetpack_Likes' ) ) {
- $custom_likes = new Jetpack_Likes;
- $sharing .= $custom_likes->post_likes( '' );
- }
- return $content . $sharing;
- }
- add_filter( 'the_content', 'jeherve_early_sharing_buttons', 5 );
- ?>
Advertisement
Add Comment
Please, Sign In to add comment