Skip to content

Instantly share code, notes, and snippets.

@bradpotter
bradpotter / functions.php
Created May 25, 2019 01:32 — forked from seothemes/functions.php
Dynamic CSS in WordPress
<?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 / add-editor-layout-classes.js
Created April 7, 2019 07:26 — forked from nickcernis/add-editor-layout-classes.js
Add Genesis layout class to Gutenberg editor pages (admin)
// 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 April 7, 2019 07:26 — forked from nickcernis/functions.php
Wrap Custom HTML WordPress blocks in a div wrapper
<?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 March 30, 2019 00:17 — 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/
<?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
*/
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.com
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
* Source: https://core.trac.wordpress.org/browser/tags/3.9/src/wp-includes/query.php
*/
$args = array(
@bradpotter
bradpotter / wp-config
Created February 26, 2013 20:56 — forked from robneu/wp-config
/** Define Gravity Forms License Key */
define("GF_LICENSE_KEY", "YOUR-LICENSE-KEY-HERE");