Skip to content

Instantly share code, notes, and snippets.

Avatar

Jon Schroeder jonschr

View GitHub Profile
@jonschr
jonschr / functions.php
Created Mar 26, 2020
Inject styles into Gutenberg without the prefix
View functions.php
function add_relative_styles_to_gutenberg() {
wp_enqueue_style( 'gutenberg-blog', get_theme_file_uri( '/css/gutenberg-blog.css' ), false );
}
add_action( 'enqueue_block_editor_assets', 'add_relative_styles_to_gutenberg' );
@jonschr
jonschr / functions.php
Created Mar 26, 2020
Add editor styles which get autoprefixed with .editor-styles-wrapper
View functions.php
function gutenberg_editor_style_setup() {
// Add support for editor styles
add_theme_support( 'editor-styles' );
// Enqueue editor styles
add_editor_style( "/css/gutenberg-style.css" );
}
add_action( 'after_setup_theme', 'gutenberg_editor_style_setup' );
View embed.html
<iframe width='750px' height='400px' frameborder='no' src='https://miatam.wildapricot.org/widget/directory' onload='tryToEnableWACookies("https://miatam.wildapricot.org");' ></iframe><br/><font style='color:#ccc;font-size:9px;font-family: Verdana, Arial, Helvetica, sans-serif;'>Powered by Wild Apricot <a style='color:#ccc' href='http://www.wildapricot.com/features' target='_blank'>Membership Software</a></font><script type="text/javascript" language="javascript" src="https://miatam.wildapricot.org/Common/EnableCookies.js" ></script>
View functions.php
///////////////////////////////
// EVENTS QUERY MODIFICATION //
///////////////////////////////
add_action( 'pre_get_posts', 'elodin_sugar_query_modificationss', 999 );
function elodin_sugar_query_modificationss( $query ) {
if ( !$query->is_main_query() )
return $query;
@jonschr
jonschr / togglegist.js
Created Jan 28, 2020
toggle the legend
View togglegist.js
<script>
jQuery(document).ready(function( $ ) {
//* vars for easier reference later
var togglelegendbutton = $( '.legendtoggle' );
var legenddiv = $( '.organizerDiv' );
var tabcontent = $( '.tabcontent' );
//* this function does everything needed to toggle it
function togglethelegend() {
View gist:a7582b6bc28c02ee789b668bbc84778b
<!-- ---------------------------------------------------------------------- -->
<!-- NOTE: Please add the following <META> element to your page <HEAD>. -->
<!-- If necessary, please modify the charset parameter to specify the -->
<!-- character set of your HTML page. -->
<!-- ---------------------------------------------------------------------- -->
<META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=UTF-8">
<!-- ---------------------------------------------------------------------- -->
<!-- NOTE: Please add the following <FORM> element to your page. -->
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 / 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);
You can’t perform that action at this time.