Skip to content

Instantly share code, notes, and snippets.

@katlove
katlove / functions.php
Created August 28, 2016 04:21
Remove Presets on Beaver Builder Child Theme
<?php
// Remove all of the Beaver Builder child theme presets
//(does not remove default as you should overwrite default with your child theme's default settings)
function es_remove_presets()
{
FLCustomizer::remove_preset( 'default-dark' );
FLCustomizer::remove_preset( 'classic' );
FLCustomizer::remove_preset( 'modern' );
FLCustomizer::remove_preset( 'bold' );
<?php
// Add home hero image as a background in head of home template only w/ media query
// Make sure you have a <div class="home-hero-image"> on the front page template
if( function_exists('get_field') ) {
if ( ! function_exists( 'home_hero_image' ) ) :
add_action( 'wp_head', 'home_hero_image', 16 );
<?php
/**
* Adding additional options in Genesis Theme Settings page for gathering a comma sep list of excluded categories
* Thanks to @author Bill Erickson for the jumping off point!
* @link http://www.billerickson.net/genesis-theme-options/
* @package yourthemenamehere
*/
/**
@katlove
katlove / gist:09187be6c39c78c0211f
Last active January 16, 2016 15:06
Encode Mailto Shortcode for WordPress
<?php
/**
* Add a shortcode for mailto link
* Use: [mailto]email@yourdomain.com[/mailto]
*/
function make_cool_mailto_shortcode( $atts , $content = null ) {
for ($i = 0; $i < strlen($content); $i++) $encodedmail .= "&#" . ord($content[$i]) . ';';
return '<a href="mailto:'.$encodedmail.'">'.$encodedmail.'</a>';
@katlove
katlove / gist:2d8a0a7aca281bbb625d
Created May 31, 2015 15:45
Add the Page Title of the Posts Page in Genesis
// Add the page title of the posts page above the posts on the post page
// (But not on the blog template, rather on the posts page set up in Settings --> Reading)
add_action( 'genesis_before', 'jh_blog_page_title' );
function jh_blog_page_title() {
if ( is_home() ) {
add_action( 'genesis_before_content', 'jh_show_blog_page_title_text' );
}
}
function jh_show_blog_page_title_text() {
@katlove
katlove / gist:d82b2e15abec81b921e4
Last active August 29, 2015 14:19
Remove the genesis layout settings for certain template files only
//* Don't show layout settings box on certain template pages admin
add_action( 'init', 'remove_layouts_templates_init' );
function remove_layouts_templates_init() {
$post_id = $_GET['post'] ? $_GET['post'] : $_POST['post_ID'] ;
$template_file = get_post_meta($post_id,'_wp_page_template',TRUE);
// check for the following template types
if ($template_file == 'page-home.php'
or $template_file == 'page-testimonial.php'
or $template_file == 'page-landing.php'