Skip to content

Instantly share code, notes, and snippets.

View agusmu's full-sized avatar

agusmu

  • Indonesia
  • 21:31 (UTC +07:00)
View GitHub Profile
@agusmu
agusmu / functions.php
Created November 5, 2013 03:21
WooCommerce - Remove result count and catalog ordering on shop page
remove_action( 'woocommerce_before_shop_loop', 'woocommerce_result_count', 20 );
remove_action( 'woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 30 );
@agusmu
agusmu / style.css
Created October 24, 2013 01:05
PrimaShop - Optimize For Big Screen
/* Optimize For Big Screen */
#container .container-inner {
width:1200px;
}
body.stylelayout-full .margin{
width:1200px;
}
body.stylelayout-boxed #container .container-inner {
width:1200px;
}
@agusmu
agusmu / functions.php
Created October 19, 2013 16:18
PrimaShop (WooCommerce) - move addtocart, meta, and social share button below product images
add_action( 'get_header', 'prima_custom_addtocart_position' );
function prima_custom_addtocart_position() {
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30);
add_action( 'woocommerce_product_thumbnails', 'woocommerce_template_single_add_to_cart', 30);
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_meta', 40);
add_action( 'woocommerce_product_thumbnails', 'woocommerce_template_single_meta', 40);
remove_action( 'woocommerce_single_product_summary', 'prima_socialite_output', 50 );
add_action( 'woocommerce_product_thumbnails', 'prima_socialite_output', 50);
<?php
/*
Usage:
$frag = new CWS_Fragment_Cache( 'unique-key', 3600 ); // Second param is TTL
if ( !$frag->output() ) { // NOTE, testing for a return of false
functions_that_do_stuff_live();
these_should_echo();
// IMPORTANT
$frag->store();
// YOU CANNOT FORGET THIS. If you do, the site will break.
<?php
/*
Usage:
cache_fragment_output( 'unique-key', 3600, function () {
functions_that_do_stuff_live();
these_should_echo();
});
*/
function cache_fragment_output( $key, $ttl, $function ) {
@agusmu
agusmu / functions.php
Created September 28, 2013 09:16
PrimaShop - hide featured header on product search result page.
/* PrimaShop (WC) - hide featured header on product search result page. */
add_action('get_header', 'prima_custom_hide_featuredheader_productsearch');
function prima_custom_hide_featuredheader_productsearch() {
if ( !is_shop() ) return;
if ( !is_search() ) return;
remove_action( 'prima_header', 'prima_header_featured_output', 30 );
}
/*
* Supposition v0.3a - an optional enhancer for Superfish jQuery menu widget
*
* Copyright (c) 2013 Joel Birch - based on work by Jesse Klaasse - credit goes largely to him.
* Special thanks to Karl Swedberg for valuable input.
*
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*/
@agusmu
agusmu / style_01.css
Created September 23, 2013 01:39
PrimaShop and UberMenu
/* add top margin to align mega menu with logo */
#header-menu .megaMenuContainer {
margin-top: 40px;
}
/* reset top margin on smaller devices */
@media only screen and (max-width: 1000px) {
#header-menu .megaMenuContainer {
margin-top: 0;
}
}
@agusmu
agusmu / functions.php
Created September 23, 2013 01:11
WooCommerce - Add Box Frame to Product Image
/* Wrap product image with a box container. */
add_action('prima_custom_scripts', 'prima_custom_product_image_box');
function prima_custom_product_image_box() {
echo 'jQuery(document).ready(function($) {';
echo '$(".woocommerce ul.products li.product a img, .woocommerce-page ul.products li.product a img").wrap("<div class=\'product-image-box\'></div>");';
echo '$(".woocommerce ul.products li.product .onsale, .woocommerce-page ul.products li.product .onsale").each(function() { var item = $(this); item.prependTo(item.parent().find(".product-image-box")); });';
echo '});';
echo "\n";
}
@agusmu
agusmu / style_01_woocommerce.css
Last active December 23, 2015 15:28
WooCommerce - Modify Product Image & Summary Width on Single Product Page
/**
* single product page layout *
* 23% (image) + 4% (spacing) + 73% (summary) = 100% *
**/
/* modify product image width */
.woocommerce div.product div.images, .woocommerce #content div.product div.images, .woocommerce-page div.product div.images, .woocommerce-page #content div.product div.images {
width: 23%;
}
/* modify product summary width */
.woocommerce div.product div.summary, .woocommerce #content div.product div.summary, .woocommerce-page div.product div.summary, .woocommerce-page #content div.product div.summary {