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 Remove dashboard widgets
add_action('wp_dashboard_setup', 'rf_remove_dashboard_widgets' );
function rf_remove_dashboard_widgets() {
// this function removes the standard dashboard widgets for all users, including the main admin
global $wp_meta_boxes;
View gist:1a188bfd8f5956af55e5
add_action( 'wp_before_admin_bar_render', 'rf_remove_toolbar_links' );
function rf_remove_toolbar_links() {
// this function removes admin bar links for all users EXCEPT for user 1
global $wp_admin_bar;
$theuserid = get_current_user_id();
if ($theuserid != 1) {
$wp_admin_bar->remove_menu('themes'); // subitem themes
$wp_admin_bar->remove_menu('customize'); // subitem customize
$wp_admin_bar->remove_menu('widgets'); // subitem widgets
$wp_admin_bar->remove_menu('background'); // subitem background
View quick fixes for barley css
.barley_editor_meta_wraper {
top:-50px !important;
#barley_editor_controls #barley_editor_insert_after,
#barley_editor_insert {
margin-top:-40px !important;
.barley_editor_main {
View Switch sidebars for CPT
function rb_change_genesis_sidebar() {
if ( 'tribe_events' == get_post_type() ) {
remove_action( 'genesis_sidebar', 'ss_do_sidebar' ); // remove the Genesis simple sidebars sidebar (this is the one being used now, but if this plugin were deactivated...)
remove_action( 'genesis_sidebar', 'genesis_do_sidebar' ); //remove the default genesis sidebar
add_action( 'genesis_sidebar', 'rb_do_sidebar' ); //add an action hook to call the function for my custom sidebar
//Function to output my custom sidebar
View gist:c2f426453db9538ca6ff
@font-face {
font-family: 'scriptina';
src: url('../font/scriptin-webfont.eot');
src: url('../font/scriptin-webfont.eot?#iefix') format('embedded-opentype'),
url('../font/scriptin-webfont.woff') format('woff'),
url('../font/scriptin-webfont.ttf') format('truetype'),
url('../font/scriptin-webfont.svg#scriptinaregular') format('svg');
font-weight: normal;
font-style: normal;
jonschr / removeyoutuberelatedvideos
Created Jul 22, 2014
Remove related videos from youtube embeds (done via ooembed) in WordPress
View removeyoutuberelatedvideos
//Remove related videos from youtube ooembed
add_filter('oembed_result', 'hide_youtube_related_videos', 10, 3);
function hide_youtube_related_videos($data, $url, $args = array()) {
$data = preg_replace('/(youtube\.com.*)(\?feature=oembed)(.*)/', '$1?' . apply_filters("hyrv_extra_querystring_parameters", "wmode=transparent&") . 'rel=0$3', $data);
return $data;
View Basic link to optin form
View Add custom attribute to specific WordPress menu item
* Add custom lightbox attribute to the menu
function prefix_menu_item_extra_atts( $atts, $item, $args )
if ( $item->object_id == '977') {
$atts['data-optin-slug'] = 'qykfszblau-lightbox';
$atts['class'] = 'manual-optin-trigger';
View Gravity forms populate events
add_filter('gform_pre_render_2', 'rb_populate_posts');
function rb_populate_posts( $form ) {
foreach( $form['fields'] as &$field ){
if( strpos( $field['cssClass'], 'eventsselection' ) === false )
$posts = get_posts( 'post_type=events&numberposts=-1' );
$choices = array(
jonschr / Override Genesis Loop
Created Dec 2, 2014
Override the Genesis loop (works when using the Grid Loop)
View Override Genesis Loop
* Use custom content for the loop
function rb_custom_loop() {
while(have_posts()) : the_post();
<article <?php post_class(); ?>>
$img = genesis_get_image( array( 'format' => 'html', 'size' => genesis_get_option( 'image_size' ), 'attr' => array( 'class' => 'post-image' ) ) );
printf( '%s', $img );
You can’t perform that action at this time.