Skip to content

Instantly share code, notes, and snippets.

# Fonts
# Add correct content-type for fonts
AddType application/x-font-ttf .ttf
## LEVERAGE BROWSER CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType application/x-font-ttf "access 1 week"
ExpiresByType image/jpg "access 1 week"
ExpiresByType image/jpeg "access 1 week"
@jasonyingling
jasonyingling / functions.php
Last active June 11, 2021 12:22
Remove Reading Time WP From Yoast og:desc
/**
* A Function to remove the auto generated Reading Time from Yoast og:desc
*
* This hooks into Yoast's `wpseo_opengraph_desc` filter and uses a regular
* expression to remove the reading time for the post
*
* @see Reading Time WP Plugin
* @link https://wordpress.org/plugins/reading-time-wp/
*
* @param string $ogdesc The excerpt grabbed by Yoast for output.
@jasonyingling
jasonyingling / gulpfile.js
Created February 1, 2019 04:26
A simple gulpfile setup for modern JavaScript and SASS
const { src, dest, watch } = require('gulp');
const sass = require('gulp-sass');
const minifyCSS = require('gulp-csso');
const babel = require('gulp-babel');
const concat = require('gulp-concat');
const browserSync = require('browser-sync').create();
function css() {
return src('./sass/*.scss', { sourcemaps: true })
.pipe(sass())
@jasonyingling
jasonyingling / functions.php
Created June 18, 2019 03:45
Adjust Reading Time WP postfix
/**
* Adjust the reading time postfix.
*/
function my_custom_reading_time( $postfix, $time, $singular, $multiple ) {
if ( $time == 1 ) {
$postfix = 'minuta';
} elseif ( $time == 2 || $time == 3 || $time == 4 ) {
$postfix = 'minuty';
} else {
$postfix = 'minut';
<body>
<?php do_action( 'wp_body_open' ); ?>
@jasonyingling
jasonyingling / gist:97e3b699d48982051952f5c37af88fde
Last active November 25, 2018 21:46
Remove Reading Time from specific posts
add_action( 'the_post', 'remove_reading_time_by_id' );
function remove_reading_time_by_id( $post_object ) {
$post_ids = array(
'53',
'10',
);
global $reading_time_wp;
if ( in_array( $post_object->ID, $post_ids ) ) {
remove_filter( 'the_content', array( $reading_time_wp, 'rt_add_reading_time_before_content') );
} else {
<a class="fancybox-form" href="#contact-jess">Email Jess</a>
<div id="contact-jess" style="display: none;">[gravityform id="5" title="true" description="true" ajax="true"]</div>
@jasonyingling
jasonyingling / gist:466f214819899e0f7087de29b2927d70
Last active June 8, 2018 16:18
DDSlick with Gravity Forms
$('.gfield select').each(function(e) {
// Hide the select element
$(this).css('display', 'none');
// clone the select element
clone = $(this).clone();
// append the cloned select after the first select
$(this).after(clone);
// store the original select ID
var selectID = $(this).attr('id');
// Call ddslick on the cloned select
@jasonyingling
jasonyingling / functions.php
Created May 24, 2018 01:59
Remove Reading Time from all but single posts in Reading Time WP
<?php
function reading_time_remove_front_page() {
if ( ! is_singular() ) {
global $readingTimeWP;
remove_filter('the_content', array($readingTimeWP, 'rt_add_reading_time_before_content'));
}
}
add_action( 'wp', 'reading_time_remove_front_page' );
$users = get_users( array( 'role' => 'author' ) );
foreach ( $users as $user ) {
the_field( 'field_name', 'user_' . $user->ID );
}