Skip to content

Instantly share code, notes, and snippets.

View eri-trabiccolo's full-sized avatar
❤️
@thomasplevy is my buddy

Rocco Aliberti eri-trabiccolo

❤️
@thomasplevy is my buddy
  • Pinerolo (TO), Italy
  • 19:02 (UTC +02:00)
View GitHub Profile
add_action('customize_controls_print_styles', 'fix_wfc_css_menu', 100);
function fix_wfc_css_menu(){
$style = '
<style id="fix_wfc">
li[id*="customize-control-tc_font"]{
display: none !important;
}
.tc-zone-section li[id*="customize-control-tc_font"]{
display: initial !important;
}
@eri-trabiccolo
eri-trabiccolo / add_hidden_site_title_in_customizr_home.php
Last active August 29, 2015 14:12
add site title to customizr home page but don't display it
add_filter('tc_logo_img_display', 'add_hidden_title_anyway');
function add_hidden_title_anyway($html){
if ( ! tc__f('__is_home') )
return $html;
$title = sprintf('<%1$s %3$s>%2$s</%1$s>',
apply_filters( 'tc_site_title_tag', 'h1'),
__( esc_attr( get_bloginfo('name') ) ),
'style="position:absolute;left:-9999px;"'
);
return $html.$title;
@eri-trabiccolo
eri-trabiccolo / change_customizr_layout_in_template.php
Last active August 29, 2015 14:12
Change the customizr layout in a template
<?php
add_filter('__screen_layout', 'my_layout', 10, 2);
function my_layout($id, $arg){
$global_layout = TC_init::$instance -> global_layout;
if ( $arg == 'class'){
return $global_layout['b']['content'];
}
return 'b';
}
?>
@eri-trabiccolo
eri-trabiccolo / change_logo_navbar_classes.php
Last active August 29, 2015 14:12
Change logo/navbar classes
add_filter('tc_navbar_wrapper_class', 'my_header_elements_class');
add_filter('tc_logo_class', 'my_header_elements_class', 15);
function my_header_elements_class($classes){
// remember replacements sum must be == 12 to have them side by side
// the default proportion is: logo 3 - navbar 9
$src_rep_classes = array(
//filter => array( search => replacement)
'tc_logo_class' => array(
'span3' => 'span5'
),
@eri-trabiccolo
eri-trabiccolo / recent_posts_slider_for_customizr.php
Last active August 29, 2015 14:12
Make a Customizr' slider show recent posts
/* Works with Customizr > 3.3.26 and Customizr-Pro > 1.1.9 */
add_filter('tc_core', 'use_custom_slider_class');
function use_custom_slider_class($classes){
//don't instantiate default class
unset( $classes['content'][
array_search(array('inc/parts','slider'), $classes['content'])
]
);
//instantiate our class
new TC_Slider_mod;
@eri-trabiccolo
eri-trabiccolo / wrap_header_in_container.php
Created January 1, 2015 20:22
Wrap the header into a div.container. to make it as wide as #main-wrapper.container
// header content wrapped
add_action('after_setup_theme', 'wrap_header');
function wrap_header(){
add_action('__header', 'tc_header_header_start', 0);
function tc_header_header_start(){
echo '<div class="tc-header-container container">';
}
add_action('__header', 'tc_header_header_end', 40);
function tc_header_header_end(){
echo '</div>';
@eri-trabiccolo
eri-trabiccolo / customizr_slider_season_based.php
Last active August 29, 2015 14:12
Automatic changing of slider depending on season
/* source: http://www.geekpedia.com/code152_Get-The-Current-Season.html */
function get_season() {
$season_slider = array('/12/21'=>'winter',
'/09/21'=>'autumn',
'/06/21'=>'summer',
'/03/21'=>'spring',
'/01/01'=>'winter'); //this needed to be at Jan 1st
foreach ($season_slider as $key => $value) // Loop through the season dates
{
$season_date = date("Y").$key;
@eri-trabiccolo
eri-trabiccolo / customizr_polylang_compatibility.php
Last active August 29, 2015 14:12
Install the Customizr-Polylang bridge code
// ====================================================================================================================
// Customizr-Polylang bridge: Makes the Customizr theme or the Featured Pages Unlimited
// plugin compatible with Polylang; Runs only if Polylang is active;
// ====================================================================================================================
// If Polylang is active, hook function on the admin pages
if ( function_exists( 'pll_register_string' ) ) add_action( 'admin_init', 'pll_tc_strings_setup' );
function pll_tc_strings_setup() {
@eri-trabiccolo
eri-trabiccolo / change_left_sidebar_classes.php
Last active August 29, 2015 14:13
Change left sidebar classes
add_filter('tc_left_sidebar_class', 'my_left_sidebar_class');
function my_left_sidebar_class($classes){
return str_replace('span4', 'span2', $classes);
}
@eri-trabiccolo
eri-trabiccolo / different_logo.php
Last active August 29, 2015 14:13
Different logo in a certain page/post
add_filter('tc_logo_src' ,'my_logo');
function my_logo($logo_src){
if ( ! is_singular() )
return;
$mylogo_src = array(
//page_or_post id => url
'31' => 'http://',
'4' => 'http:// '
);