Skip to content

Instantly share code, notes, and snippets.

@robneu
robneu / time.php
Last active March 25, 2017 19:36 — forked from gleddy/time.php
cookbook snippet
// customize single post header content for dx5
add_action( 'genesis_entry_header', 'dx5_do_post_header');
function dx5_do_post_header() {
genesis_markup( array(
'html5' => '<header %s>',
'context' => 'dx5-post-heading',
) );
@robneu
robneu / cookbook-print.php
Last active February 10, 2017 16:44
Add custom inline styles to the Cookbook print/print preview.
<?php
add_action( 'cookbook_recipe_print_head', 'prefix_cookbook_inline_print_css', 99 );
/**
* Inline custom print styles in the Cookbook print head.
*
* @since 1.0.0
* @access public
* @return void
*/
@robneu
robneu / .htaccess
Last active February 1, 2017 20:47 — forked from brichards/.htaccess
Tell Apache to serve missing images from a remote server. Props http://stackoverflow.com/questions/5130410/modrewrite-to-another-server-if-file-image-is-not-found
# BEGIN serve images from production
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f [NC]
RewriteRule ^(.*\.(js|css|png|jpe?g|gif|ico|svg)) http://example.com/$1 [NC,P,L]
</IfModule>
# END serve images from production
@robneu
robneu / cookbook-image-size.php
Created January 18, 2017 17:13
Modify the default recipe image size in Cookbook.
<?php
add_filter( 'cookbook_recipe_image_size', 'prefix_get_recipe_image_size' );
/**
* Modify the default cookbook recipe image size.
*
* @since 1.0.0
* @param string $size The current image size.
* @return string
*/
@robneu
robneu / cookbook-template-strings.php
Last active January 17, 2017 19:05
Change the default template strings in Cookbook for WordPress
<?php
add_filter( 'cookbook_strings', 'prefix_custom_strings' );
/**
* Modify the default template strings in Cookbook.
*
* @since 1.0.0
* @param array $strings The default template strings.
* @return array
*/
@robneu
robneu / debug-log.php
Created September 29, 2016 18:25
Write a debug log to the WP uploads directory. Use tail -f in a terminal to watch for changes on the fly
<?php
/**
* Write a debug log.
*
* @param mixed $msg A message to log.
*/
function sitecare_debug_log( $msg = null ) {
if ( ! is_string( $msg ) ) {
$msg = print_r( $msg, true );
@robneu
robneu / facet-wp-infinite-scroll.js
Last active October 9, 2021 22:26
Infinite scroll for FacetWP
/* globals FWP */
/**
* JavaScript for FacetWP Infinite Scroll
*/
(function( $ ) {
'use-strict';
var throttleTimer = null;
var throttleDelay = 100;
<?php
add_action( 'wp_enqueue_scripts', 'prefix_disable_wp_featherlight_woocommerce', 10 );
/**
* Remove all required scripts and styles on WooCommerce pages.
*
* @since 0.1.0
* @access public
* @return void
*/
function prefix_disable_wp_featherlight_woocommerce() {
@robneu
robneu / video-embed.html
Last active March 23, 2018 15:50
Embed a YouTube video using featherlight.js
<a href="https://www.youtube.com/embed/CEYRBTZWu8U" data-featherlight="iframe" data-featherlight-iframe-width="960" data-featherlight-iframe-height="540">
<img class="alignnone" src="http://img.youtube.com/vi/CEYRBTZWu8U/maxresdefault.jpg" alt="" width="1280" height="720" />
</a>
<?php
if ( ! function_exists( 'shitty_pluggable_function' ) ) {
function shitty_pluggable_function() {
echo 'I am a piece of shit and I wish I was never created';
}
}