Skip to content

Instantly share code, notes, and snippets.

//Deregister Gravity Stylesheets and Scripts from specific pages
add_action("gform_enqueue_scripts", "deregister_scripts");
function deregister_scripts(){
//Change this conditional to target whatever page or form you need.
if(is_front_page()) {
@bryanwillis
bryanwillis / bsg-multilevel-nav.css
Created March 22, 2016 20:28
Bootstrap Genesis Multilevel Nav
ul.dropdown-menu .caret {
display: inline-block;
width: 0;
height: 0;
margin-left: 2px;
vertical-align: middle;
border-left: 4px solid;
border-right: 4px solid transparent;
border-top: 4px solid transparent;
border-bottom: 4px solid transparent;
<?php # Do not include this line if used in functions.php
/**
* WP scripts to Footer with jQuery Google CDN support.
*
* Ensures that Modernizr/HTM5shiv is loaded
* in the head for IE9 and less support
*
* @package Optimize_WP_Scripts_Loading
* @author BryanWillis
@bryanwillis
bryanwillis / style-formats.php
Last active April 18, 2018 05:17
Tinymce Advanced Style Formats Example for Wordpress. Example of using HTML5 formatting in TINYMCE Visual Editor for Wordpress taken from this example on TinyMCE's site ( link https://www.tinymce.com/docs/demo/format-html5/ ).
<?php
/**
* HTML5 Styles Dropdown
*
* @author Bryan Willis
* @link https://www.tinymce.com/docs/demo/format-html5/
*/
function mce_html5_formatting( $init ) {
@bryanwillis
bryanwillis / debug-atts.php
Last active July 29, 2019 23:52
This allows you to debug all of the known genesis attributes available for filtering. Genesis attributes are used for adding classes, schema.org markup, id's, and any other html attributes to elements. Drop this in your functions.php
<?php
/**
* Debug Genesis Attributes
* @author Bryan Willis
*/
add_action( 'wp_footer', 'debug_genesis_attr_filters' );
function debug_genesis_attr_filters()
{
global $wp_filter; // current_filter() might be a better way to do this
$genesis_attr_filters = array ();
<?php
$genesis_atts = array(
'nav-primary',
'nav-secondary',
'site-header',
'site-inner',
'content-sidebar-wrap',
'content',
'sidebar-primary',
<?php
/* STYLES IN EDITOR - Multiple stylesheets
================================================== */
function child_load_editor_mce_css( $mce_css ) {
if ( ! empty( $mce_css ) ) {
$mce_css .= ',';
}
$mce_css .= BW_CHILD_URL_DIST . '/bootstrap/css/bootstrap.css';
@bryanwillis
bryanwillis / load-scripts.php
Last active January 31, 2016 01:20
The correct way to load html5shiv in Genesis Theme Framework. See relative WPSE answer regarding this - http://wordpress.stackexchange.com/a/214460/43806. Currently the `load-scripts.php` file looks a little confused. It registers the html5 script, but then decides to add it using `wp_head`. It's also calling the $wp_scripts global which isn't n…
<?php
/**
* Genesis Framework.
*
* WARNING: This file is part of the core Genesis Framework. DO NOT edit this file under any circumstances.
* Please do all modifications in the form of a child theme.
*
* @package Genesis\Assets
* @author StudioPress
* @license GPL-2.0+
@bryanwillis
bryanwillis / bootstrap-genesis-structural-wraps.php
Last active October 5, 2020 18:16
Adding genesis-structural-wrap-support to Bootstrap Genesis
<?php
/**
* Module: Bootstrap Genesis Plugin - Structural Wraps
* Author: Bryan Willis
*/
/**
* Add theme support for structural wraps
*/
function gb3_add_theme_support_structural_wraps() {
@bryanwillis
bryanwillis / admin-publish-posts.php
Last active April 8, 2016 08:11
Gravity Forms User Capabilities / Roles - Using user_has_cap (which is a simpler filter than map_meta_cap), allows Editors to view and manage form entries. #user_has_cap #role #currrent_user_can
<?php
// Only administrators can delete published posts:
add_filter( 'map_meta_cap',
function( $required_caps, $cap ) {
if ( 'delete_post' == $cap )
$required_caps[] = 'manage_options';
return $required_caps;
}, 10, 2 );