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:46 (UTC +02:00)
View GitHub Profile
@eri-trabiccolo
eri-trabiccolo / allow_fp_per_user_role.php
Last active August 29, 2015 14:18
Allow fp per user role
add_action('wp_head', 'change_fp_ids');
function change_fp_ids(){
add_filter('fpc_featured_pages_ids', 'my_fp_ids', 20);
function my_fp_ids( $fp_ids ){
// Allowed users
$allowed = array(
// Page/Post name => list of allowed users
'Blog' => array(
@eri-trabiccolo
eri-trabiccolo / post_lists_articles_boxed.css
Created March 30, 2015 18:02
Post lists articles in a box
body:not(.single-post) #content > article {
padding: 15px 20px;
margin: 0 0 25px;
background: #ffffff none repeat scroll top left;
background-image: none;
border: solid 6px #9800cb;
-moz-box-shadow: 0 0 5px rgba(0, 0, 0, .1);
-webkit-box-shadow: 0 0 5px rgba(0, 0, 0, .1);
-goog-ms-box-shadow: 0 0 5px rgba(0, 0, 0, .1);
box-shadow: 0 0 5px rgba(0, 0, 0, .1);
@eri-trabiccolo
eri-trabiccolo / footnotes_compatibility.php
Created March 29, 2015 13:54
Footnotes compatibility
if ( class_exists('MCI_footnotes') ):
function re_enqueue_footnotes_script() {
// first dequeue it
wp_dequeue_script('mci-footnotes-js-jquery-tools');
// enqueue it after tc-scripts
wp_enqueue_script('mci-footnotes-js-jquery-tools', plugins_url() . '/footnotes/js/jquery.tools.min.js', array('tc-scripts') );
}
add_action( 'wp_print_scripts', 're_enqueue_footnotes_script', 100 );
endif;
@eri-trabiccolo
eri-trabiccolo / extra_widget_area_after_header_in_home.php
Created March 27, 2015 18:15
Extra widget area after header in home
// Adds a widget area.
if (function_exists('register_sidebar')) {
register_sidebar( array(
'name' => 'Extra Header Widget Area',
'id' => 'extra-header-widget-area',
'description' => 'Extra widget area after the header',
'before_widget' => '<div class="widget my-extra-header-widget">',
'after_widget' => '</div>',
'before_title' => '<h2>',
'after_title' => '</h2>'
@eri-trabiccolo
eri-trabiccolo / add_slides_recent_posts_slider.php
Last active August 29, 2015 14:17
Add slides to the slider of recent posts
add_filter('tc_post_slides', 'add_custom_slides', 10, 2);
function add_custom_slides( $slides, $img_size){
$slides = is_array( $slides ) ? $slides : array();
/*
* set this as an empty array if you don't want slides before this way:
* $my_slides_before = array();
*/
$my_slides_before = array(
'my_316' => array( // replace my_316 with my_ID_of_your_attachment
'title' => 'Some title',
@eri-trabiccolo
eri-trabiccolo / disable_metas_in_search_pages.php
Created March 27, 2015 07:23
Disable metas in search pages
add_filter('tc_show_post_metas', 'disable_metas_in_search', 20);
function disable_metas_in_search( $bool ){
if ( is_search() )
return false;
return $bool;
}
@eri-trabiccolo
eri-trabiccolo / hide_fp_fpu.php
Last active August 29, 2015 14:17
Hide some featured pages in FPU
add_action('wp_head', 'change_fp_ids');
function change_fp_ids(){
add_filter('fpc_featured_pages_ids', 'my_fp_ids', 20);
function my_fp_ids( $fp_ids ){
$role_page = array(
// Role => Page/Post name
'administrator' => 'Blog',
'editor' => 'A',
);
// do nothing if in admin backend or in the customize
@eri-trabiccolo
eri-trabiccolo / page-of-posts.php
Last active August 29, 2015 14:17
Customizr page of posts template
<?php
/*
* Template Name: Page of Posts
*/
/* Configuration */
$design_layout = 'grid'; /* or alternate */
$show_page_title = true; /* or false */
$number_of_posts = 0; /* -1 stays for unlimited, 0 will use the Maximum number of posts per page settings */
/* bind a page to a category*/
@eri-trabiccolo
eri-trabiccolo / search_box_below_header.php
Created March 22, 2015 11:45
Search box below header
add_theme_support( 'html5', array( 'search-form' ) );
add_action('__after_header', 'my_woocommerce_search_form');
function my_woocommerce_search_form(){
$search_form = '<div class="row-fluid"><div class="my-search-box span12">' . get_search_form(false) . '</div></div>';
echo $search_form;
}
/* part to copy into the custom css or child-theme style.css DO NOT COPY INTO THE CHILD THEME functions.php !
.my-search-box{
padding: 20px 10px;
-webkit-box-sizing: border-box;
@eri-trabiccolo
eri-trabiccolo / show_date_before_title_in_posts_pages.php
Created March 22, 2015 09:51
Show the date before the title in post/page
add_action('__before_content_title', 'show_date_before_title');
function show_date_before_title(){
$show_in_pages = false;
if ( method_exists('TC_post_metas', 'tc_get_meta_date') && ! ( is_page() && ! $show_in_pages ) )
echo TC_post_metas::$instance->tc_get_meta_date();
}