Skip to content

Instantly share code, notes, and snippets.

$.localScroll({
duration: 900
});
@About2git
About2git / gist:7e3e10a27988c75807dd
Created February 15, 2015 22:24 — forked from srikat/gist:8393474
WooCommerce: Shortcode for outputting number of products in cart. Usage: [wc_num_items]. Reference: http://docs.woothemes.com/document/show-cart-contents-total/
add_shortcode('wc_num_items', 'function_wc_num_items');
function function_wc_num_items($atts) {
global $woocommerce;
$cart_contents_count = $woocommerce->cart->cart_contents_count;
return $cart_contents_count;
}
@About2git
About2git / gist:61772cd614a087a0ee4a
Created February 15, 2015 22:23 — forked from srikat/gist:8393618
Parse <br> in WordPress widget titles. Source: http://wpmu.org/wordpress-widget-title-html/
//* Enable line breaks in widget titles
add_filter( 'widget_title', 'html_widget_title' );
function html_widget_title( $title ) {
$title = str_replace( '[', '<', $title );
$title = str_replace( 'br]', 'br>', $title );
return $title;
}
@About2git
About2git / style.css
Last active August 29, 2015 14:15 — forked from srikat/style.css
CSS to make the output of Jetpack Subscription widget better in Genesis child theme, News 2.1.2. Details with screenshots: https://twitter.com/srikat/status/422551589824376832
.jetpack_subscription_widget .widget-wrap {
background: url("images/enews.png") no-repeat 260px 15px;
}
#subscribe-email #subscribe-field {
width: 175px;
padding: 5px;
font-size: 13px;
margin: 10px -2px 0 0;
}
@About2git
About2git / functions.php
Created February 15, 2015 22:21 — forked from srikat/functions.php
Adding Portfolio Type taxonomy in Minimum Pro
<?php
//* Start the engine
include_once( get_template_directory() . '/lib/init.php' );
//* Set Localization (do not remove)
load_child_theme_textdomain( 'minimum', apply_filters( 'child_theme_textdomain', get_stylesheet_directory() . '/languages', 'minimum' ) );
//* Child theme (do not remove)
define( 'CHILD_THEME_NAME', __( 'Minimum Pro Theme', 'minimum' ) );
define( 'CHILD_THEME_URL', 'http://my.studiopress.com/themes/minimum/' );
@About2git
About2git / functions.php
Last active August 29, 2015 14:15 — forked from srikat/functions.php
Customize the post meta function to show Tags on Category pages, Categories on Tag archives and both Tags and Categories on single Posts and views other than static Pages
//* Customize the post meta function to show Tags on Category pages, Categories on Tag archives and both Tags and Categories on single Posts and views other than static Pages
add_filter( 'genesis_post_meta', 'sk_post_meta_filter' );
function sk_post_meta_filter($post_meta) {
if ( is_category() ) {
$post_meta = '[post_tags]';
}
elseif ( is_tag() ) {
$post_meta = '[post_categories]';
@About2git
About2git / gist:ff44eb10d91962dd4b0b
Last active August 29, 2015 14:15 — forked from srikat/gist:8414387
Using different sidebars for different Pages/Posts using labels in Dynamik
// Switch sidebars
add_action( 'get_header', 'change_genesis_sidebar' );
function change_genesis_sidebar() {
if ( dynamik_has_label('leads') || dynamik_has_label('prospects') || dynamik_has_label('customers') ) {
remove_action( 'genesis_sidebar', 'genesis_do_sidebar' );
add_action( 'genesis_sidebar', 'sk_do_sidebar' );
}
}
@About2git
About2git / functions.php
Created February 15, 2015 22:21 — forked from srikat/functions.php
Adding a responsive mobile menu in any iThemes Builder theme
// Enqueuing and Using Custom Javascript/jQuery
function custom_load_custom_scripts() {
if ( file_exists( get_stylesheet_directory() . '/js/custom_jquery_additions.js' ) )
$url = get_stylesheet_directory_uri() . '/js/custom_jquery_additions.js';
else if ( file_exists( get_template_directory() . '/js/custom_jquery_additions.js' ) )
$url = get_template_directory_uri() . '/js/custom_jquery_additions.js';
if ( ! empty( $url ) )
wp_enqueue_script( 'custom_jquery_additions', $url, array('jquery'), false, true );
}
add_action( 'wp_enqueue_scripts', 'custom_load_custom_scripts' );
@About2git
About2git / functions.php
Created February 15, 2015 22:20 — forked from srikat/functions.php
Making Utility Bar and Header fixed in Agency Pro
// Wrap Utility Bar and Header in a custom div
add_action( 'genesis_before_header', 'sk_opening_div', 9 );
function sk_opening_div() {
echo '<div class="my-site-header">';
}
add_action( 'genesis_after_header', 'sk_closing_div', 9 );
function sk_closing_div() {
@About2git
About2git / functions.php
Last active August 29, 2015 14:15 — forked from srikat/functions.php
Adding Before Entry widget area in Genesis
//* Register before-entry widget area
genesis_register_sidebar( array(
'id' => 'before-entry',
'name' => __( 'Before Entry', 'your-theme-slug' ),
'description' => __( 'This is the before entry section.', 'your-theme-slug' ),
) );
//* Hooks before-entry widget area to single posts
add_action( 'genesis_entry_content', 'sk_after_entry_widget', 9 );
function sk_after_entry_widget() {