Skip to content

Instantly share code, notes, and snippets.

View motorcitymobi's full-sized avatar

Cameron Cecchini motorcitymobi

View GitHub Profile
@GaryJones
GaryJones / functions.php
Last active August 25, 2018 11:50
Enqueue any style sheet with a conditional comment (usually for IE)
<?php
add_action( 'wp_enqueue_scripts', 'prefix_add_ie8_style_sheet', 200 );
/**
* Enqueue an IE-specific style sheet.
*
* Add a style sheet for everyone, then mark it as conditional to IE8 or below.
*
* @author Gary Jones
* @link https://garyjones.io/enqueued-style-sheet-extras#ie
@billerickson
billerickson / gist:2047229
Last active July 10, 2023 22:04
Improve performance of WP_Query
<?php
$args = array(
// Normal query goes here //
'no_found_rows' => true, // counts posts, remove if pagination required
'update_post_term_cache' => false, // grabs terms, remove if terms required (category, tag...)
'update_post_meta_cache' => false, // grabs post meta, remove if post meta required
);
<!doctype html>
<!-- http://taylor.fausak.me/2015/01/27/ios-8-web-apps/ -->
<html>
<head>
<title>iOS 8 web app</title>
<!-- CONFIGURATION -->
@billerickson
billerickson / gist:3698476
Last active February 23, 2024 16:49 — forked from luetkemj/wp-query-ref.php
WP: Query $args
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.com
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query
* Source: http://core.trac.wordpress.org/browser/tags/3.3.1/wp-includes/query.php
*/
$args = array(
<?php
add_filter( 'jpeg_quality', 'tgm_image_full_quality' );
add_filter( 'wp_editor_set_quality', 'tgm_image_full_quality' );
/**
* Filters the image quality for thumbnails to be at the highest ratio possible.
*
* Supports the new 'wp_editor_set_quality' filter added in WP 3.5.
*
* @since 1.0.0
*
@wpsmith
wpsmith / functions-enqueue.php
Last active February 20, 2017 09:04
Add Nagging Menu to WordPress Site
<?php
add_action( 'init', 'wps_register_nagging_script' );
/**
* Register Nagging script
*
* @uses CHILD_THEME_VERSION set this via wp_get_theme()->Version
* @link https://gist.github.com/4477270 Sets Child Theme Constants via wp_get_theme()
* @link https://gist.github.com/4083811 For jQuery alternative to be placed in footer
*/
@cdils
cdils / archive-testimonials.php
Last active April 17, 2023 20:13
This is code for a custom page template removing the standard Genesis loop and inserting a custom loop. Similar to https://gist.github.com/4684423.js, but without a grid loop.
<?php
/**
* Template Name: Testimonial Archives
* Description: Used as a page template to show page contents, followed by a loop through a CPT archive
*/
remove_action ('genesis_loop', 'genesis_do_loop'); // Remove the standard loop
add_action( 'genesis_loop', 'custom_do_loop' ); // Add custom loop
@GaryJones
GaryJones / functions.php
Last active December 17, 2015 11:29
Amended post date styling, including the year
<?php
add_filter( 'genesis_post_date_shortcode', 'child_post_date_shortcode', 10, 2 );
/**
* Customize Post Date format and add extra markup for CSS targeting.
*
* Includes the year as well.
*
* @author Gary Jones
* @link http://code.garyjones.co.uk/style-post-info/
@jdevalk
jdevalk / archive-speaking_event.php
Last active December 12, 2021 20:13
Genesis helper code for schema
<?php
add_filter( 'genesis_attr_content', 'yoast_schema_empty', 20 );
add_filter( 'genesis_attr_entry', 'yoast_schema_event', 20 );
add_filter( 'genesis_attr_entry-title', 'yoast_itemprop_name', 20 );
add_filter( 'genesis_attr_entry-content', 'yoast_itemprop_description', 20 );
add_filter( 'genesis_post_title_output', 'yoast_title_link_schema', 20 );
/**
* We'll use the post info output to add more meta data about the event.
@studiopress
studiopress / add-featured-image-size.php
Last active January 14, 2017 02:40
Genesis grid loop.