Skip to content

Instantly share code, notes, and snippets.

View woogist's full-sized avatar

WooCommerce.com Documentation woogist

View GitHub Profile
@woogist
woogist / new_gist_file
Created May 30, 2013 10:07
Add text text to the top menu in canvas
function woo_top_navigation() {
if ( function_exists( 'has_nav_menu' ) && has_nav_menu( 'top-menu' ) ) {
?>
<div id="top">
<div class="col-full">
<div id="topnavtext"> Text Here</div>
<?php
echo '<h3 class="top-menu">' . woo_get_menu_name( 'top-menu' ) . '</h3>';
wp_nav_menu( array( 'depth' => 6, 'sort_column' => 'menu_order', 'container' => 'ul', 'menu_id' => 'top-nav', 'menu_class' => 'nav top-navigation fl', 'theme_location' => 'top-menu' ) );
?>
@woogist
woogist / new_gist_file
Created May 30, 2013 13:20
Custom fix for scrollider mini cart
add_action("wp_head","custom_fix_cart");
function custom_fix_cart(){
?>
<script type="text/JavaScript">
jQuery(document).ready(function(){
jQuery('.mini-cart .cart-parent').live("click", function() {
jQuery('#header .cart_list').fadeToggle('fast', function() {
return false;
@woogist
woogist / gist:5681832
Created May 30, 2013 22:40
Sensei - Whitelight Wrapper Start
// IF Whitelight
case 'whitelight' :
echo '<div id="content"><div class="page col-full"><div id="main" class="col-left">';
break;
@woogist
woogist / gist:5681836
Created May 30, 2013 22:41
Sensei - Whitelight Wrapper End
// IF Whitelight
case 'whitelight' :
?>
</div>
<?php get_sidebar(); ?>
</div>
</div>
<?php
break;
@woogist
woogist / gist:5692886
Last active January 23, 2021 17:56
Sample WooCommerce Points & Rewards 3rd Party Plugin Integration
<?php
// Add the action setting
add_filter( 'wc_points_rewards_action_settings', 'points_rewards_newsletter_action_settings' );
function points_rewards_newsletter_action_settings( $settings ) {
$settings[] = array(
'title' => __( 'Points earned for newsletter signup' ),
'desc_tip' => __( 'Enter the amount of points earned when a customer signs up for a newsletter via MailChimp.' ),
@woogist
woogist / new_gist_file
Created June 2, 2013 08:24
Order product category by ( woocommerce )
add_filter('woocommerce_get_catalog_ordering_args', 'am_woocommerce_catalog_orderby');
function am_woocommerce_catalog_orderby( $args ) {
$args['orderby'] = 'title';
$args['order'] = 'ASC';
$args['meta_key'] = '';
return $args;
}
@woogist
woogist / new_gist_file
Created June 2, 2013 10:12
super store contact bar
function superstore_contact() {
global $woo_options;
?>
<ul class="contact">
<?php if ( isset($woo_options['woo_contact_number']) && $woo_options['woo_contact_number'] != '' ) { ?><li class="phone"><a href="tel:<?php echo esc_html( $woo_options['woo_contact_number'] ); ?>"><?php echo esc_html( $woo_options['woo_contact_number'] ); ?></a></li><?php } ?>
<?php if ( isset($woo_options['woo_contact_fax']) && $woo_options['woo_contact_fax'] != '' ) { ?><li class="fax"><?php echo esc_html( $woo_options['woo_contact_fax'] ); ?></li><?php } ?>
<?php if ( isset( $woo_options['woo_contact_twitter'] ) && $woo_options['woo_contact_twitter'] != '' ) { ?><li class="twitter"><a href="http://twitter.com/<?php echo esc_attr( $woo_options['woo_contact_twitter'] ); ?>">@<?php echo esc_html( $woo_options['woo_contact_twitter'] ); ?></a></li><?php } ?>
<?php if ( isset( $woo_options['woo_connect_facebook'] ) && $woo_options['woo_connect_facebook'] != '' ) { ?><li class="facebook"><a href="<?php echo $woo_
@woogist
woogist / new_gist_file
Created June 3, 2013 15:08
Chante the order of the archive page
add_filter('pre_get_posts', 'pre_get_posts_hook' );
function pre_get_posts_hook($wp_query) {
if (is_category() || is_archive())
{
$wp_query->set( 'orderby', 'title' );
$wp_query->set( 'order', 'ASC' );
return $wp_query;
}
}
@woogist
woogist / functions.php
Created June 7, 2013 03:06
Add a search to the On Topic navigation
add_filter( 'wp_nav_menu_items', 'woo_custom_top_search', 10, 2 );
function woo_custom_top_search ( $items, $args ) {
global $woo_options;
if ( $args->theme_location == 'primary-menu' && is_single()) {
$template_directory = get_template_directory_uri();
ob_start();
register_sidebar( array( 'name' => __( 'Header Widget', 'woothemes' ), 'id' => 'header-widget', 'description' => __( 'The default header widget area for your theme.', 'woothemes' ), 'before_widget' => '<div id="%1$s" class="widget %2$s">', 'after_widget' => '</div>', 'before_title' => '<h3>', 'after_title' => '</h3>' ) );