Skip to content

Instantly share code, notes, and snippets.

@robneu
robneu / get-script-handles.php
Last active April 25, 2024 01:01
Display a list of all currently enqueued script handles. Useful for manual minification when using Better WordPress Minify and other similar plugins.
<?php
/**
* Output a list of all enqueued script handles.
*
* @author FAT Media, LLC
* @global $wp_scripts
* @todo Change 'prefix' to your theme or plugin prefix.
*/
function prefix_print_script_handles() {
@robneu
robneu / truncate-yoast-breadcrumb.php
Last active October 2, 2023 14:11
Truncate the title of Yoast's WordPress SEO breadcrumbs.
<?php
/**
* Truncate the title of Yoast's WordPress SEO breadcrumbs.
*
* Sometimes you will have post titles which are longer than you want
* them to be in your breadcrumbs. This will allow you to set a maximum
* length for the post title used in Yoast's breadcrumb function.
*
* @author FAT Media, LLC
* @link http://wpbacon.com/tutorials/truncate-wordpress-seo-breadcrumbs/
@robneu
robneu / wordpress-typekit-enqueue.php
Last active January 17, 2023 23:04 — forked from FernE97/typekit-enqueue.php
Enqueue typekit fonts to WordPress using wp_enqueue_scripts.
<?php
/**
* Enqueue typekit fonts into WordPress using wp_enqueue_scripts.
*
* @author Robert Neu
* @author Eric Fernandez
* @copyright Copyright (c) 2014, Robert Neu
* @license GPL-2.0+
* @link http://typekit.com
*/
@robneu
robneu / wordpress-font-awesome-cdn.php
Last active November 29, 2022 10:47
Add Font Awesome to WordPress using a CDN
<?php
add_action( 'wp_enqueue_scripts', 'prefix_enqueue_awesome' );
/**
* Register and load font awesome CSS files using a CDN.
*
* @link http://www.bootstrapcdn.com/#fontawesome
* @author FAT Media
*/
function prefix_enqueue_awesome() {
wp_enqueue_style( 'prefix-font-awesome', '//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css', array(), '4.0.3' );
@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 / genesis-ss-podcasting.php
Created June 4, 2014 20:24
Move the podcast player to another location in Genesis when using the Seriously Simple Podcasting plugin.
<?php
add_action( 'genesis_before_content', 'prefix_move_podcast_player' );
/**
* Remove the podcast meta filter on the_content.
*
* By default, the Seriously Simple Podcasting plugin will display the media
* player and other file info within the content. This doesn't allow for much
* flexibility with the placement, so this removes the filter and hooks a
* function to display the podcast meta elswhere in the markup.
@robneu
robneu / wordpress-change-category-posts-per-page.php
Last active January 26, 2021 09:05
Set the number of posts per page in all WordPress category archives using pre_get_posts.
<?php
add_action( 'pre_get_posts', 'prefix_category_query' );
/**
* Customize category query using pre_get_posts.
*
* @author FAT Media <http://youneedfat.com>
* @copyright Copyright (c) 2013, FAT Media, LLC
* @license GPL-2.0+
* @todo Change prefix to theme or plugin prefix
<?php
/**
* Simple Grid helper functions.
*
* @package SimpleGrid
* @subpackage Genesis
* @copyright Copyright (c) 2014, Flagship, LLC
* @license GPL-2.0+
* @since 1.0.0
*/
@robneu
robneu / genesis-searchwp-image-search.php
Last active September 14, 2019 21:25
Create a custom search template to display custom search results using SearchWP and the Genesis Framework.
<?php
/**
* This file adds the SearchWP Images template to your theme.
*
* Template Name: SearchWP Images
*
* @author Robert Neu
* @package Genesis
* @subpackage SearchWP
*/