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
  • 09:11 (UTC +02:00)
View GitHub Profile
@eri-trabiccolo
eri-trabiccolo / different-menu.php
Created February 20, 2015 15:26
Different menu
add_filter('tc_menu_args', 'my_menus');
function my_menus($args){
$page_menu = array(
//page_id => menu_id
'19' => '14',
'2' => '2'
);
if ( is_page() && array_key_exists(tc__f('__ID'), $page_menu) )
$args['menu'] = $page_menu[tc__f('__ID')];
return $args;
@eri-trabiccolo
eri-trabiccolo / fp_pages.php
Last active June 14, 2016 09:06
different featured pages in different pages
$page_fpc = array(
'2' => array(
'per_row' => 3,
'fp' => array(
'one' => '8',
'two' => '9',
'three' => '10',
'4' => '12',
'5' => '7'
),
@eri-trabiccolo
eri-trabiccolo / use_woocommerce_breadcrumbs.php
Last active May 17, 2016 14:17
Use woocommerce breadcrumbs
add_action( 'wp', 'tc_woocommerce_breadcrumb', 100 );
function tc_woocommerce_breadcrumb() {
//do nothing if we're not in the wc context
if ( ! ( function_exists( 'is_woocommerce' ) && is_woocommerce() ) )
return;
//turn off the theme's breadcrumb
add_filter( 'tc_opt_tc_breadcrumb', '__return_false' );
//display woocommerce breadcrumb before the main container
@eri-trabiccolo
eri-trabiccolo / archive-listing.php
Created February 17, 2016 08:41
Customizr - WP_Listings: Archive template
<?php
/**
* The template for displaying Listing Archive pages
*
* @link http://codex.wordpress.org/Template_Hierarchy
*
* @package WP Listings
* @since 0.1.0
*/
@eri-trabiccolo
eri-trabiccolo / single-listing.php
Created February 17, 2016 08:35
Customizr - WP_Listings: Single template
<?php
/**
* The Template for displaying all single listing posts
*
* @package WP Listings
* @since 0.1.0
*/
add_action('wp_enqueue_scripts', 'enqueue_single_listing_scripts');
function enqueue_single_listing_scripts() {
@eri-trabiccolo
eri-trabiccolo / smartload_in_one_page.php
Created February 3, 2016 08:00
Customizr: smartload enabled in one specific page
add_filter('tc_opt_tc_img_smart_load', 'smartload_in_one_page');
function smartload_in_one_page() {
//is_page parameter : Page ID, title, slug, or array of such
return is_page('A') ? true : false;
}
@eri-trabiccolo
eri-trabiccolo / term_description_below_post_navigation.php
Last active January 22, 2016 10:53
Display term description below the post navigation
$term_description_filters = array(
'cat',
'tag',
'tax'
);
//do not automatically show term descriptions below the title
foreach ( $term_description_filters as $filter )
add_filter( "tc_show_{$filter}_description", "__return_false");
//show term description after the posts navigation
@eri-trabiccolo
eri-trabiccolo / mini_header_mobile.css
Last active January 10, 2016 18:28
Mini header in mobile devs
@media (max-width: 979px) {
.tc-header {
border-bottom: none;
}
header.tc-header {
min-height: 40px;
}
.tc-header .brand {
@eri-trabiccolo
eri-trabiccolo / exclude_skins.php
Last active January 10, 2016 13:05
Exclude skins from random skins
add_filter('tc_skins_to_randomize', 'exclude_skins');
function exclude_skins( $_skins ){
$_my_excluded = array(
'grey.css',
'grey2.css'
);
foreach ( $_my_excluded as $key )
if ( array_key_exists( $key, $_skins ) )
unset( $_skins[$key] );
@eri-trabiccolo
eri-trabiccolo / custom_post_types_no_customizr_mb.php
Created January 7, 2016 14:58
Remove Customizr meta boxes from custom post types
//remove customizr metaboxes from custom post types edit screen
add_action( 'add_meta_boxes', 'remove_customizr_metaboxes', 20 );
function remove_customizr_metaboxes() {
//array of custom post types
$custom_post_types = get_post_types( array( '_builtin' => false ) );
$current_post_type = get_post_type();
if ( in_array( $current_post_type, $custom_post_types ) ) {
remove_meta_box('layout_sectionid', $current_post_type, 'normal' );
remove_meta_box('slider_sectionid', $current_post_type, 'normal' );
}