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
  • 12:18 (UTC +02:00)
View GitHub Profile
@eri-trabiccolo
eri-trabiccolo / add_sidebars_classes.php
Created June 4, 2015 09:06
Add class to right and left Customizr sidebars
add_filter('tc_right_sidebar_class', 'my_sidebar_class');
add_filter('tc_left_sidebar_class', 'my_sidebar_class');
function my_sidebar_class( $_classes ){
$_classes = array_merge( $_classes, array('sticky') );
return $_classes;
}
@eri-trabiccolo
eri-trabiccolo / page_custom_content_width.php
Created May 29, 2015 13:48
Page template with custom content's width.
<?php
/*
* Template Name: Page with custom content's width
*
*/
/* Custom params */
$window_content = array(
// min window's width => container's width
'1200px' => '98%',
'768px' => '95%',
@eri-trabiccolo
eri-trabiccolo / something_1_2_fpu_row.php
Last active August 29, 2015 14:21
Action hook between the first and the second FPU row
$n_match = 0;
function fp_action(){
global $n_match;
$n_match++;
ob_start();
do_action("__between_fp_rows_{$n_match}");
$my_action = ob_get_contents();
if (! $my_action ) return '';
ob_end_clean();
return $my_action;
@eri-trabiccolo
eri-trabiccolo / social_links_same_window.php
Created May 21, 2015 07:00
Social links opening in the same window
@eri-trabiccolo
eri-trabiccolo / tagline_below_logo.php
Last active September 1, 2018 07:36
Tagline below the logo
add_action('wp_head', 'move_tagline_below_logo');
function move_tagline_below_logo(){
if ( ! method_exists('TC_header_main', 'tc_tagline_display') )
return;
remove_action('__navbar', array(TC_header_main::$instance, 'tc_tagline_display'), is_rtl() ? 10 : 20 );
add_action('__after_logo', array(TC_header_main::$instance, 'tc_tagline_display') );
add_filter('tc_tagline_class', 'span7_to_12');
function span7_to_12( $_class){
@eri-trabiccolo
eri-trabiccolo / sticky-header-offset.php
Created May 18, 2015 18:12
Add sticky-header offset
add_filter('tc_customizr_script_params', 'add_sticky_offset_param');
function add_sticky_offset_param( $params){
$params['stickyCustomOffset'] = '45'; /* in pixels */
return $params;
}
@eri-trabiccolo
eri-trabiccolo / menu_item_attr_manipulation.php
Created May 13, 2015 08:59
Menu item attribute manipulation
add_filter( 'nav_menu_link_attributes', 'menu_item_data_toggle', 10, 2 );
function menu_item_data_toggle( $atts, $item) {
// Manipulate attributes
if ( 74 == $item -> ID )
$atts['data-toggle'] = 'modal';
return $atts;
}
@eri-trabiccolo
eri-trabiccolo / fp_cat_tag_posts.php
Created May 7, 2015 16:04
Featured pages populated with category/tag posts
/* configuration */
$fpc_by__conf = array(
'by' => 'category', /* or 'tag'*/
'is' => '1', /* category id , or tag name */
'per_row' => '', /* set this to 'fpc' if you want to use the FP settings */
'nb_max' => '' /* set this to 'fpc' if you want to use the FP settings */
);
/*
* per_row and nb_max behavior:
*
@eri-trabiccolo
eri-trabiccolo / pub_date_category.php
Created May 7, 2015 15:57
Show publication date in just one category
add_filter('tc_opt_tc_show_post_metas_publication_date', 'show_pub_date_in_category');
function show_pub_date_in_category( $bool ){
//replace 1 with the category ID
return is_archive() ? is_category(1) : $bool;
}
add_action('template_redirect', 'socials_in_menu', 20);
function socials_in_menu(){
remove_action('__navbar', array(TC_header_main::$instance, 'tc_social_in_header'), 10);
add_filter( 'tc_social_header_block_class', '__return_empty_string', 20);
add_filter('wp_nav_menu_items', 'add_socials_to_menu', 10, 2);
function add_socials_to_menu($items, $args) {
// If this isn't the main navbar menu, do nothing
if( !($args->theme_location == 'main') )
return $items;