Skip to content

Instantly share code, notes, and snippets.

Jon Schroeder jonschr

Block or report user

Report or block jonschr

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
View functions.php
// Add 'yst_prominent_words to the array of excluded taxonomies
function modify_categories_dropdown( $taxonomies ) {
$taxonomies[] = 'yst_prominent_words';
return $taxonomies;
}
add_filter( 'beautiful_filters_taxonomies', 'modify_categories_dropdown', 10, 1 );
@jonschr
jonschr / functions.php
Created Feb 18, 2019
Add body classes for current page and all ancestors
View functions.php
/**
* Add classes for pages and page parents
*/
function prefix_add_specific_body_classes($classes) {
// Bail if we're not on a page
if (is_page()) {
global $post;
@jonschr
jonschr / functions.php
Last active Feb 8, 2019
Registering colors for use with Guetenberg
View functions.php
/**
* Set the theme colors
*/
add_action( 'after_setup_theme', 'prefix_register_colors' );
function prefix_register_colors() {
add_theme_support(
'editor-color-palette', array(
array(
'name' => esc_html__( 'Black', 'prefix_textdomain' ),
'slug' => 'black',
@jonschr
jonschr / plugin.php
Last active Feb 1, 2019
Pulling in video URLs from an ACF addon plugin
View plugin.php
//* Get the background image information (if the video is local)
$video_mp4 = wp_get_attachment_url( get_post_meta( $id, $context_prefix . $count . '_video_mp4', true ) );
$video_webm = wp_get_attachment_url( get_post_meta( $id, $context_prefix . $count . '_video_webm', true ) );
$image_fallback = wp_get_attachment_url( get_post_meta( $id, $context_prefix . $count . '_image_fallback', true ) );
@jonschr
jonschr / functions.php
Created Jan 25, 2019
Remove the wpautop filter
View functions.php
/**
* Remove the wpautop filter from the_content
*/
remove_filter( 'the_content', 'wpautop' );
add_filter( 'the_content', function ($content) {
if (has_blocks()) {
return $content;
}
return wpautop($content);
@jonschr
jonschr / functions.php
Last active Jan 25, 2019
Get theme colors into a usable format
View functions.php
/**
* Get the colors formatted for use with Iris, Automattic's color picker
*/
function output_the_colors() {
// get the colors
$color_palette = current( (array) get_theme_support( 'editor-color-palette' ) );
// bail if there aren't any colors found
if ( !$color_palette )
@jonschr
jonschr / functions.php
Created Jan 15, 2019
Hooking into the ACF color picker and adding the colors
View functions.php
/**
* Add the colors into Iris
*/
add_action( 'acf/input/admin_footer', 'gutenberg_sections_register_acf_color_palette' );
function gutenberg_sections_register_acf_color_palette() {
$color_palette = output_the_colors();
if ( !$color_palette )
return;
@jonschr
jonschr / _button.scss
Created Oct 19, 2018
Some button styles in .scss
View _button.scss
.button-custom {
display: inline-block;
background: transparent;
color: white;
text-transform: uppercase;
padding: 5px 35px;
font-size: 16px;
font-family: "Roboto", Sans-serif;
font-weight: 500;
position: relative;
View index.php
<?php
//* Add text above the loop on the main blog page
add_action( 'genesis_archive_title_descriptions', 'add_main_blog_description' );
function add_main_blog_description() {
global $post;
// Bail if this is an archive page (not the blog page)
if ( is_archive() )
@jonschr
jonschr / archive-faq.php
Last active Jan 28, 2018
An example custom loop page (uses the standard query, but does whatever it wants inside the loop)
View archive-faq.php
<?php
/**
* NOTE: We force the full-width content in the functions.php file already; no need to do that here as well.
*/
/**
* Remove the standard loop
*/
remove_action( 'genesis_loop', 'genesis_do_loop' );
You can’t perform that action at this time.