Skip to content

Instantly share code, notes, and snippets.

@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 / gist:1e983bc4187ca2ae683e0938ee111755
Created September 17, 2021 13:30
Clear RunCloudHub Cache
if ( class_exists('RunCloud_Hub') && is_callable( array( 'RunCloud_Hub', 'purge_cache_all_noaction' ) ) ) {
RunCloud_Hub::purge_cache_all_noaction();
}
@agusmu
agusmu / style.css
Created January 3, 2015 11:01
WooCommerce - Full Width Cart Totals
.woocommerce .cart-collaterals .cart_totals, .woocommerce-page .cart-collaterals .cart_totals {
float: none;
width: 100%;
text-align: left;
}
<?php
/**
* Filter the output of image_downsize() to return dynamically generated images for intermediate or inline sizes.
*
* <p>Because Wordpress generates all image sizes on first upload, if you change
* theme or size settings after the upload, there won't be a matching file for
* the requested size.<br/>
* This filter addresses the problem of the default downsize process laoding
* a large file and scaling it down in the browser if it doesn't find the right
* size image. This can cause large files to be loaded unnecessarily and will
@agusmu
agusmu / flying-press.conf
Created October 4, 2020 23:30 — forked from gijo-varghese/flying-press.conf
Nginx Config for FlyingPress
location ~* \.html$ {
add_header x-flying-press-cache HIT;
add_header x-flying-press-source Nginx;
}
set $flying_press_cache 1;
set $flying_press_url "/wp-content/cache/flying-press/$request_uri/index.html";
set $flying_press_file "$document_root/wp-content/cache/flying-press/$request_uri/index.html";
if ($request_method = POST) {
@agusmu
agusmu / functions.php
Created July 24, 2013 08:42
WooCommerce - Adding category, excerpt, and SKU to shop page
/* Adding category, excerpt, and SKU to shop page */
add_action( 'woocommerce_after_shop_loop_item', 'prima_custom_shop_item', 5);
function prima_custom_shop_item() {
global $post, $product;
/* product categories */
$size = sizeof( get_the_terms( $post->ID, 'product_cat' ) );
echo $product->get_categories( ', ', '<p>' . _n( 'Category:', 'Categories:', $size, 'woocommerce' ) . ' ', '.</p>' );
/* product excerpt */
@agusmu
agusmu / Customizerref.php
Created March 29, 2020 05:29 — forked from cryptexvinci/Customizerref.php
WordPress Customizer Sample Reference
<?php
/**
* WordPress Customizer Comprehensive Reference
* Compiled by @ti_asif
*/
Panel
Section
@agusmu
agusmu / style.css
Last active December 5, 2019 17:55
WooCommerce - Customize Price Using CSS
/* WooCommerce Price (Default) */
.woocommerce ul.products li.product .price, .woocommerce-page ul.products li.product .price, .woocommerce div.product span.price, .woocommerce div.product p.price, .woocommerce #content div.product span.price, .woocommerce #content div.product p.price, .woocommerce-page div.product span.price, .woocommerce-page div.product p.price, .woocommerce-page #content div.product span.price, .woocommerce-page #content div.product p.price {
color: #333333;
font-size: 1em;
font-weight: normal;
}
/* WooCommerce Price (From Text) */
.woocommerce ul.products li.product .price .from, .woocommerce-page ul.products li.product .price .from, .woocommerce div.product span.price .from, .woocommerce div.product p.price .from, .woocommerce #content div.product span.price .from, .woocommerce #content div.product p.price .from, .woocommerce-page div.product span.price .from, .woocommerce-page div.product p.price .from, .woocommerce-page #content div.product span.price .from, .woocommerce-page #con
@agusmu
agusmu / spp.php
Last active August 18, 2019 16:25 — forked from khromov/spp.php
<?php
/*
Plugin Name: Simple Popular Posts Lite
Plugin URI: -
Description: -
Version: 2014.10.16
Author: khromov
Author URI: http://snippets.khromov.se
License: GPL2
*/
@agusmu
agusmu / style.css
Created July 10, 2013 00:46
WooCommerce - One Column Checkout
/* one column checkout page */
.woocommerce #customer_details.col2-set .col-1, .woocommerce-page #customer_details.col2-set .col-1,
.woocommerce #customer_details.col2-set .col-2, .woocommerce-page #customer_details.col2-set .col-2 {
clear: both;
float: none !important;
width: 100% !important;
margin-right:0 !important;
text-align: left;
padding-bottom: 20px;
}