Skip to content

Instantly share code, notes, and snippets.

View nucab's full-sized avatar
🏠
Working from home

Noah U nucab

🏠
Working from home
View GitHub Profile
<?php
/*
Plugin Name: Disable W3 Total Cache Nags
Version: 1.0
Author: Blue Liquid Designs
*/
add_action( 'wp_loaded', 'bld_disable_w3_total_cache_nags' );
function bld_disable_w3_total_cache_nags()
<?php the_widget( 'WC_Widget_Product_Categories', 'title=&hierarchical=1&orderby=name&dropdown=1' ); ?>
<?php the_widget( 'WC_Widget_Product_Categories', 'title=&hierarchical=1&orderby=name&dropdown=1' ); ?>
<?php the_widget( 'WC_Widget_Product_Categories', 'title=&hierarchical=1&orderby=name&dropdown=1' ); ?>
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.com
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
* Source: https://core.trac.wordpress.org/browser/tags/3.9/src/wp-includes/query.php
*/
$args = array(
<?php
// Load our function when hook is set
add_action( 'pre_get_posts', 'rc_modify_query_get_posts_by_date' );
// Modify the current query
function rc_modify_query_get_posts_older_than_today( $query ) {
// Check if on frontend and main query is modified
if( ! is_admin() && $query->is_main_query() ) {
@nucab
nucab / gist:fd0c2089564745386cb4
Last active August 29, 2015 14:24 — forked from woogist/gist:5975638
Woocommerce - Change number of products displayed per page
<?php
/**
* WooCommerce Extra Feature
* --------------------------
*
* Change number of related products on product page
* Set your own value for 'posts_per_page'
*
*/
function woo_related_products_limit() {
select.form-control + .chosen-container.chosen-container-single .chosen-single {
display: block;
width: 100%;
height: 34px;
padding: 6px 12px;
font-size: 14px;
line-height: 1.428571429;
color: #555;
vertical-align: middle;
background-color: #fff;
@nucab
nucab / index.php
Last active August 29, 2015 14:25 — forked from jameskoster/index.php
<ul class="products">
<?php
$args = array(
'post_type' => 'product',
'posts_per_page' => 12
);
$loop = new WP_Query( $args );
if ( $loop->have_posts() ) {
while ( $loop->have_posts() ) : $loop->the_post();
wc_get_template_part( 'content', 'product' );
// Display 24 products per page. Goes in functions.php
add_filter( 'loop_shop_per_page', create_function( '$cols', 'return 24;' ), 20 );