Skip to content

Instantly share code, notes, and snippets.

View mbrughi's full-sized avatar

Marco Brughi mbrughi

View GitHub Profile
@mbrughi
mbrughi / woocommerce-myaccount-sorting-order.php
Last active September 25, 2017 06:42
Woocommerce MyAccount Sorting Links
// Woocommerce MyAccount Sorting Links
// Ordinamento funzioni nella pagina my account di woocommerce
function mb_woo_my_account_order() {
$myorder = array(
'dashboard' => __( 'Bacheca', 'woocommerce' ),
'points' => __( 'Raccolta Punti', 'woocommerce' ),
'cataloghi-per-rivenditori' => __( 'Cataloghi per rivenditori', 'woocommerce' ),
'orders' => __( 'Storico Ordini', 'woocommerce' ),
'my-account-fatture' => __( 'Le tue fatture', 'woocommerce' ),
'termini-e-condizioni' => __( 'Condizioni D\'Acquisto', 'woocommerce' ),
@mbrughi
mbrughi / wp-analytics.php
Created November 1, 2017 17:25
Wordpress: insert Google Analytics code.
function my_google_analytics() {
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-69841290-2"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-69841290-2');
</script>
@mbrughi
mbrughi / wp-excerpt-length.php
Created November 1, 2017 17:49
Wordpress: change excerpt lenght.
function my_excerpt_length( $length ) {
$length = '35'; // change the length in words you want
return $length;
}
add_filter( 'excerpt_length', 'my_excerpt_length' );
@mbrughi
mbrughi / style.css
Last active November 10, 2017 08:39
Wordpress Genesis Style base child
/*
Theme Name: genesischild
Theme URI: http://marcobrughi.com/
Description: Simple child theme for Genesis Framework.
Author: Marco Brughi
Author URI: http://marcobrughi.com/
Version: 1.0
Tags: custom-background, custom-header, featured-images, threaded-comments, two-columns
@mbrughi
mbrughi / gist:2bab259b013177dd6c73b35ecc70ea29
Created December 2, 2017 08:35
Genesis Grid Loop 1 feat 2 col
remove_action( 'genesis_loop', 'genesis_do_loop' );
add_action( 'genesis_loop', 'child_grid_loop_helper', 55 );
/** Add support for Genesis Grid Loop **/
function child_grid_loop_helper() {
if ( function_exists( 'genesis_grid_loop' ) ) {
genesis_grid_loop( array(
'features' => 1,
'feature_image_size' => 250,
@mbrughi
mbrughi / gist:53e9bd935dada4eefb423006601733b5
Created December 2, 2017 08:36
Genesis Grid Loop 2 Col
remove_action( 'genesis_loop', 'genesis_do_loop' );
add_action( 'genesis_loop', 'child_grid_loop_helper', 55 );
/** Add support for Genesis Grid Loop **/
function child_grid_loop_helper() {
if ( function_exists( 'genesis_grid_loop' ) ) {
genesis_grid_loop( array(
'features' => 0,
'feature_image_size' => 'featured-image',
@mbrughi
mbrughi / gist:5a54fcd825b43f575aff61cf50b9c902
Created December 2, 2017 08:38
Genesis Grid Loop Feature + 2 Col Grid
//* Genesis grid loop
function minimum_grid_loop_helper() {
if ( function_exists( 'genesis_grid_loop' ) ) {
genesis_grid_loop( array(
'features' => 1,
'feature_image_size' => 'featured-image',
'feature_content_limit' => 0,
'grid_image_size' => 'grid-image',
'grid_content_limit' => 0,
@mbrughi
mbrughi / gist:abc57c06f96bbf76ffa09bd79b026af2
Created December 2, 2017 08:43
Genesis Grid Loop w/help
remove_action( 'genesis_loop', 'genesis_do_loop' );
add_action( 'genesis_loop', 'child_grid_loop_helper' );
function child_grid_loop_helper() {
if ( function_exists( 'genesis_grid_loop' ) ) {
genesis_grid_loop( array(
'features' => 1, // Num. post to show full size
'feature_image_size' => 650, // Size of image features post
'feature_image_class' => 'aligncenter post-image', // alignment of features image
'feature_content_limit' => 150, // number of characters of the post to show in the features section (set to 0, which will return the full content).
'grid_image_size' => 'grid-thumbnail', // Image size of other post (set in functions.php)
@mbrughi
mbrughi / genesis-favicon.php
Created January 10, 2018 09:44
Display your own Favicon in Genesis Child Themes.
/** Adding My custom Favicon
* (change www.mywebsite.com with your website url)
*/
add_filter( 'genesis_pre_load_favicon', 'my_custom_favicon' );
function my_custom_favicon( $favicon_url ) {
return 'http://www.mywebsite.com/images/favicon.png';
}
// or better use relative URL
@mbrughi
mbrughi / limit-titlelenght.php
Created January 17, 2018 16:48
Wordpress: limit title lenght.
function max_title_length( $title ) {
$max = 20;
if( strlen( $title ) > $max ) {
return substr( $title, 0, $max ). " &hellip;";
} else {
return $title;
}
}