Skip to content

Instantly share code, notes, and snippets.

View DigitalEssence's full-sized avatar

Hedley Phillips DigitalEssence

View GitHub Profile
@DigitalEssence
DigitalEssence / gist:6478938
Created September 7, 2013 20:21
If you work on genesis child themes a lot then this code (originally by Chris Cree) will save you loads of time. First create a custom.css file with your custom styles and FTP it up to your child theme directory. Then add the below code to your child theme's functions.php file.
add_action( 'wp_enqueue_scripts', 'wsm_custom_stylesheet' );
function wsm_custom_stylesheet() {
wp_enqueue_style( 'custom-style', get_stylesheet_directory_uri() . '/custom.css' );
}
@DigitalEssence
DigitalEssence / regsiter-sidebar-widget
Created September 9, 2013 13:37
php to register a sidebar widget in Genesis
//* Register a new widget area in Genesis
genesis_register_sidebar( array(
'id' => 'widget-name',
'name' => __( 'Text to show in dashboard', 'custom-theme' ),
'description' => __( 'Dexcription to show.', 'custom-theme' ),
) );
@DigitalEssence
DigitalEssence / Edit Genesis Search Box Text
Created November 4, 2013 15:56
Edit Genesis Search Box Text
<?php
//* Do NOT include the opening php tag above
/**
* Customize the default text inside of search box
*/
add_filter( 'genesis_search_text', 'custom_search_box_text' );
function custom_search_box_text( $text ) {
return esc_attr( 'Search our website...' );
@DigitalEssence
DigitalEssence / Edit Genesis Search Button Text
Created November 4, 2013 15:58
Edit Genesis Search Button Text
<?php
//* Do NOT include the opening php tag above
add_filter( 'genesis_search_button_text', 'custom_search_button_text' );
function custom_search_button_text( $text ) {
return esc_attr('Go for it!');
}
@DigitalEssence
DigitalEssence / adding-custom-css
Created November 4, 2013 16:40
Adding and enqueuing custom css to the login screen
// Add styling
function my_login_stylesheet() {
$mycustomcssurl = plugins_url( 'custom.css', __FILE__ );
wp_register_style( 'custom-css', $mycustomcssurl,'','', 'screen' );
wp_enqueue_style( 'custom-css' );
}
add_action( 'login_enqueue_scripts', 'my_login_stylesheet' );
@DigitalEssence
DigitalEssence / create-shadow-border
Created November 15, 2013 15:57
Create a shadow border around div
.divclassname {
box-shadow: 0 3px 6px rgba(0, 0, 0, 0.2);
-moz-box-shadow: 0 3px 6px rgba(0, 0, 0, 0.2);
-webkit-box-shadow: 0 3px 6px rgba(0,0,0, .2);
background: #fff;
margin: 0 3px 40px;
padding: 20px 0 0;
}
@DigitalEssence
DigitalEssence / gist:faf84e2ee33a4939e545
Created February 18, 2015 10:28
Wordpress - Add Custom Image Size to Admin Area
//////////////////////////////////
// Add new image size to WordPress
//////////////////////////////////
add_image_size( 'catalog', 490, 340, array( 'center', 'top' ) ); // Hard crop center top
// make the new size available in the media library (and image element etc.)
add_filter( 'image_size_names_choose', 'my_custom_images' );
function my_custom_images( $sizes ) {
return array_merge( $sizes, array(
'catalog' => __( 'Catalogue Image' ),
) );
@DigitalEssence
DigitalEssence / gist:e18f3d892aa4831d0a18
Created February 18, 2015 10:29
Enfold - Enable Shortcodes in Child Theme
//////////////////////////////////
// Enable Shortcodes to be used in the child theme
//////////////////////////////////
add_filter('avia_load_shortcodes', 'avia_include_shortcode_template', 15, 1);
function avia_include_shortcode_template($paths)
{
$template_url = get_stylesheet_directory();
array_unshift($paths, $template_url.'/shortcodes/');
return $paths;
@DigitalEssence
DigitalEssence / gist:42ec2b076b96e481a737
Created February 18, 2015 10:30
WooCommerce - Add short description to the product loop
// Add short description to the product loop
add_action('woocommerce_after_shop_loop_item_title','woocommerce_template_single_excerpt', 5);
@DigitalEssence
DigitalEssence / gist:02091ec16309117715ef
Created February 18, 2015 10:31
Reduce the Latest News Widget excerpt to X words
/* Reduce the Latest News Widget excerpt to X words */
function custom_excerpt_length( $length ) {
return X;
}
add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );