Skip to content

Instantly share code, notes, and snippets.

Brad Potter bradpotter

Block or report user

Report or block bradpotter

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@bradpotter
bradpotter / functions.php
Created May 25, 2019 — forked from seothemes/functions.php
Dynamic CSS in WordPress
View functions.php
<?php
/**
* Load dynamic CSS stylesheet in WordPress. There are 4 steps:
*
* 1. Enqueue dynamic stylesheet on front end or add inline CSS if in Customizer.
* 2. Get the dynamic CSS with AJAX calls.
* 3. Generate CSS using PHP variables.
* 4. Minify CSS after before loading.
*/
@bradpotter
bradpotter / verse-cpt.php
Last active May 23, 2019
First run at Bible Verse CPT
View verse-cpt.php
add_action( 'init', 'book_create_custom_taxonomy' );
function book_create_custom_taxonomy() {
// Book
$book = array(
'name' => _x( 'Book', 'taxonomy general name' ),
'singular_name' => _x( 'Book', 'taxonomy singular name' ),
'menu_name' => __( 'Book' ),
'all_items' => __( 'All Books' ),
'parent_item' => __( 'Parent Book' ),
@bradpotter
bradpotter / functions.php
Last active May 7, 2019
Place a reusable Gutenberg block via a Genesis hook. (Where 956 is the Post ID of your reusable block)
View functions.php
add_action( 'genesis_before_footer', 'my_custom_query' );
function my_custom_query() {
$post_id = 956;
$queried_post = get_post($post_id);
echo $queried_post->post_content;
}
@bradpotter
bradpotter / add-editor-layout-classes.js
Created Apr 7, 2019 — forked from nickcernis/add-editor-layout-classes.js
Add Genesis layout class to Gutenberg editor pages (admin)
View add-editor-layout-classes.js
// Add genesis layout classes to the Block Editor.
// File lives in the theme's /js/ folder.
wp.domReady(function () {
yourTheme.updateLayoutClass();
var layouts = document.querySelector(".genesis-layout-selector");
layouts.addEventListener("input", function (e) {
yourTheme.updateLayoutClass();
});
});
@bradpotter
bradpotter / functions.php
Created Apr 7, 2019 — forked from nickcernis/functions.php
Wrap Custom HTML WordPress blocks in a div wrapper
View functions.php
<?php
add_filter( 'render_block', 'custom_wrap_html_block_output', 10, 2 );
/**
* Wrap output of HTML blocks.
*
* @param string $block_content Original block content.
* @param array $block Block info.
* @return string The block content with a wrapper.
*/
@bradpotter
bradpotter / class-custom-featured-post.php
Created Mar 30, 2019 — forked from srikat/class-custom-featured-post.php
Custom Featured Posts Widget plugin: Skeleton for amending the output of the Genesis Featured Posts widget. https://sridharkatakam.com/custom-featured-post-widget-plugin/
View class-custom-featured-post.php
<?php
/**
* Plugin Name
*
* @package Custom_Featured_Post_Widget
* @author Gary Jones
* @license GPL-2.0+
* @link http://gamajo.com/
* @copyright 2013 Gary Jones, Gamajo Tech
*/
@bradpotter
bradpotter / onboarding.php
Created Dec 20, 2018
Modify onboarding.php to include additional pages
View onboarding.php
return array(
'dependencies' => array(
'plugins' => array(
array(
'name' => __( 'Atomic Blocks', 'genesis-sample' ),
'slug' => 'atomic-blocks/atomicblocks.php',
),
),
),
'content' => array(
@bradpotter
bradpotter / functions.php
Last active Dec 15, 2017
Modify post type for Gutenberg
View functions.php
function modify_post_type() {
//new args
$args = array(
'public' => true,
'label' => 'Posts',
'show_in_rest' => true,
'template' => array(
array( 'core/cover-image' ),
array( 'core/image' ),
@bradpotter
bradpotter / responsive-menu.js
Created Jun 9, 2016
Sample Theme Responsive Menu Mods
View responsive-menu.js
/**
* Accessibility-ready responsive menu.
*/
( function ( document, $, undefined ) {
$( 'body' ).addClass( 'js' );
'use strict';
@bradpotter
bradpotter / functions.php
Created Jun 9, 2016
Sample Theme Functions file
View functions.php
<?php
/**
* Genesis Sample.
*
* This file adds functions to the Genesis Sample Theme.
*
* @package Genesis Sample
* @author StudioPress
* @license GPL-2.0+
* @link http://www.studiopress.com/
You can’t perform that action at this time.