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
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/
@bradpotter
bradpotter / page-title-1.html
Last active Feb 18, 2016
Page title 1 or 2
View page-title-1.html
<div class="site-inner">
<div class="content-sidebar-wrap">
<header class="entry-header">
<h1 class="entry-title" itemprop="headline">Sample Page</h1>
</header>
<main class="content" id="genesis-content">
<article class="post-31 page type-page status-publish entry" itemscope="" itemtype="http://schema.org/CreativeWork">
<div class="entry-content" itemprop="text">
@bradpotter
bradpotter / widget-template-1.php
Last active Aug 29, 2015
Page template to use with auto sidebar registration
View widget-template-1.php
<?php
/**
* This file adds the Custom Widget Page Template to ThemeCore.
*
* @author Brad Potter
* @package ThemeCore
* @subpackage Customizations
*/
/*
You can’t perform that action at this time.