Skip to content

Instantly share code, notes, and snippets.

@ramseyp
ramseyp / hide-editor.php
Created November 12, 2012 15:48
Hide the content editor for certain pages in WordPress
<?php
/**
* Hide editor on specific pages.
*
*/
add_action( 'admin_init', 'hide_editor' );
function hide_editor() {
// Get the Post ID.
define( 'CHILD_THEME_VERSION', filemtime( get_stylesheet_directory() . '/style.css' ) );
@jaredatch
jaredatch / gist:5617223
Last active May 18, 2016 03:05
GravityForms doesn't have a filter for the * required marker, so this JS changes it.
jQuery(document).ready(function($) {
$("span.gfield_required").html(function(index, text) {
return text.replace("*", "Required");
});
});
@jdevalk
jdevalk / archive-speaking_event.php
Last active December 12, 2021 20:13
Genesis helper code for schema
<?php
add_filter( 'genesis_attr_content', 'yoast_schema_empty', 20 );
add_filter( 'genesis_attr_entry', 'yoast_schema_event', 20 );
add_filter( 'genesis_attr_entry-title', 'yoast_itemprop_name', 20 );
add_filter( 'genesis_attr_entry-content', 'yoast_itemprop_description', 20 );
add_filter( 'genesis_post_title_output', 'yoast_title_link_schema', 20 );
/**
* We'll use the post info output to add more meta data about the event.
@srikat
srikat / functions.php
Last active April 22, 2021 11:48
Showing a different menu in Primary Navigation location conditionally in Genesis
<?php
//* Do NOT include the opening php tag
add_action( 'genesis_before', 'sk_replace_menu_in_primary' );
/**
* Conditionally replace Custom Menu in Primary Navigation.
*
* @author Sridhar Katakam
* @link http://sridharkatakam.com/conditionally-replace-navigation-menu-genesis/
*/
@JiveDig
JiveDig / genesis_custom_loop.php
Last active March 4, 2020 15:33
wp_query using genesis_custom_loop. To alter content use standard genesis add_action and remove_action hooks
<?php
//* Custom loop WITH pagination
remove_action( 'genesis_loop', 'genesis_do_loop' );
add_action( 'genesis_loop', 'bhl_do_resident_query' );
function bhl_do_resident_query() {
global $paged;
global $query_args;
@A5hleyRich
A5hleyRich / cron-test.php
Last active July 26, 2022 17:25
WordPress Cron and Email Test
<?php
/**
* Plugin Name: Cron Test
* Plugin URI: https://gist.github.com/A5hleyRich/6de1712ce5f46662c8ba
* Description: WordPress cron and email test.
* Author: Ashley Rich
* Version: 1.0
* Author URI: http://ashleyrich.com
*/
@jaredatch
jaredatch / functions.php
Created August 5, 2015 14:57
Set fallback images for Genesis
<?php
/**
* Set default Genesis images
*
* @since 1.0.0
* @param string $output
* @param array $args
* @return array
*/
function ja_default_genesis_image( $output, $args ) {
@jaredatch
jaredatch / functions.php
Last active February 28, 2022 22:04
Disable TinyMCE for specific page
<?php
/**
* Disable visual TinyMCE editor for specifc page/post
*
* @since 1.0.0
*/
function ja_disable_fancy_editor( $can ) {
global $post;
if ( 3441 == $post->ID ) {
@jaredatch
jaredatch / functions.php
Created August 5, 2015 19:08
Tame Yoast plugins
<?php
// Tell Yoast Google Analytics plugin not to be at the top of the WP admin menu
add_filter( 'wpga_menu_on_top', '__return_false' );
// Disable additional WPSEO columns from the admin
add_filter( 'wpseo_use_page_analysis', '__return_false' );
/**
* Set WPSEO metabox to low so custom fields can appear above it