Skip to content

Instantly share code, notes, and snippets.

View craigsimps's full-sized avatar

Craig Simpson craigsimps

View GitHub Profile
<?php
/**
* Template Name: Testimonials - Native Functions
*/
add_action( 'genesis_entry_content', 'prefix_output_testimonials' );
/**
* Output ACF testimonials.
*
* @link https://acfextras.com/simple-testimonials-repeater-field/
<?php
/**
* Create new 'meta_content` filter.
*
* Recreate the default filters applied to `the_content`,
* so content retrieved using `get_post_meta` can be
* formatted in the same way.
*/
add_filter( 'meta_content', 'wptexturize' );
@craigsimps
craigsimps / beaver.php
Last active September 21, 2017 10:27
<?php
/**
* Modify theme to support Beaver Builder better.
*
* - Set the theme layout to full width.
* - Remove the `site-inner` markup.
* - Remove the `content-sidebar-wrap` markup.
* - Remove the entry header and page/ post title.
*
* @package Generico\Core
<?php
// Force content-sidebar layout.
add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_content_sidebar' );
// Force sidebar-content layout.
add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_sidebar_content' );
// Force content-sidebar-sidebar layout.
add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_content_sidebar_sidebar' );
<?php
/**
* Add custom body class.
*
* @param array $classes Array of existing body classes.
*
* @return array
*/
add_filter( 'body_class', function( $classes ) {
$(document).on('facetwp-loaded', function () {
/*
* Initialize Soliloquy sliders if they're loaded while filtering.
*
* If a Soliloquy slider is loaded in by Ajax, such is the case
* in the Creative Portfolio section, it won't be initialized. In
* order to do so, we need to call some Ajax of our own and output
* the neccessary JS.
*/
<?php
add_action( 'wp_ajax_project_init_soliloquy_sliders', 'project_ajax_init_sliders' );
add_action( 'wp_ajax_nopriv_project_init_soliloquy_sliders', 'project_ajax_init_sliders' );
/**
* Grabs JS and executes it for any uninitialised Soliloquy sliders on screen
*
* Used in `global.js` to initialize any sliders loaded
* by AJAX requests e.g. after an Infinite Scroll event.
*
<?php
add_action( 'bcn_after_fill', 'project_rebuild_breadcrumb' );
/**
* Rebuild the breadcrumb created by Breadcrumb NavXT.
*
* @param bcn_breadcrumb_trail $breadcrumb Instance of the currently active breadcrumb trail.
*/
function project_rebuild_breadcrumbs( $breadcrumb ) {
<?php
add_filter( 'genesis_post_info', __NAMESPACE__ . '\\post_info_filter' );
/**
* Filter the post info.
*
* @return string
*/
function post_info_filter() {
return '[post_date] by [post_author_posts_link] [post_comments] [post_edit]';
<?php
add_filter( 'genesis_post_meta', __NAMESPACE__ . '\\post_meta_filter' );
/**
* Filter the post meta.
*
* @return string
*/
function post_meta_filter() {
return '[post_categories] [post_tags]';