Skip to content

Instantly share code, notes, and snippets.

View gecugamo's full-sized avatar

Gary Cuga-Moylan gecugamo

View GitHub Profile
@gecugamo
gecugamo / Gruntfile.js
Last active December 18, 2015 02:54
Gruntfile.js with SASS and PostCSS
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
sass: {
dist: {
options: {
sourcemap: 'none'
},
files: {
'assets/css/style.css': 'assets/scss/main.scss'
@gecugamo
gecugamo / Gruntfile.js
Last active March 18, 2021 19:53
Gruntfile.js with sass, postcss, concat, uglify, and watch
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
sass: {
dist: {
options: {
sourcemap: 'inline'
},
files: {
'dist/css/style.css' : 'src/scss/style.scss'
@gecugamo
gecugamo / back-to-top.js
Last active November 30, 2015 16:47
Simple Back to Top
(function IIFE($) {
$('.back-to-top').on('click', function(e) {
e.preventDefault();
$('html, body').animate({
scrollTop: 0
}, 500);
});
})(jQuery);
<?php
function products_query( $query )
{
if ( ! $query->is_main_query() || is_admin() )
{
return $query;
}
if ( is_post_type_archive( 'product' ) || is_tax())
{
<?php
// Add product to request list
function add_product_id($product_id) {
$product_ids = get_product_ids();
// If product id is in array, return
if (in_array($product_id, $product_ids)) {
return;
}
@gecugamo
gecugamo / gform_grid.css
Last active December 2, 2015 22:04
CSS to allow use of Bootstrap grid with Gravity Forms
.gform_fields {
list-style-type: none;
margin-right: -15px;
margin-left: -15px;
padding: 0;
}
.gfield {
margin-bottom: 15px;
padding-right: 15px;
@gecugamo
gecugamo / pre-get-posts.php
Created December 3, 2015 17:47
Pre Get Posts Filter
<?php
function pgp_filter( $query ) {
if ( $query->is_main_query() && !is_admin() ) {
$query->set( $key, $value );
}
}
add_action( 'pre_get_posts', 'pgp_filter' );
@gecugamo
gecugamo / wp-content.gitignore
Created December 7, 2015 16:52
wp-content.gitignore
*.log
advanced-cache.php
backup-db/
backups/
blogs.dir/
cache/
upgrade/
uploads/
wp-cache-config.php
@gecugamo
gecugamo / pagination.php
Created February 7, 2017 22:20
WordPress Pagination
<?php
if ( ! function_exists( 'pagination' ) ) :
function pagination($pages = '') {
global $paged;
if(empty($paged)) $paged = 1;
if($pages == '')
@gecugamo
gecugamo / breadcrumbs.php
Created February 7, 2017 22:20
WordPress Breadcrumbs
<?php
if ( ! function_exists( 'breadcrumbs' ) ) :
function breadcrumbs() {
echo '<ul class="breadcrumbs">';
if ( ! is_home() ) {
echo '<li><a href="' . esc_url( get_option( 'home' ) ) . '">Home</a></li>';
}
if ( is_category() ) {