Skip to content

Instantly share code, notes, and snippets.

View jonschr's full-sized avatar

Jon Schroeder jonschr

View GitHub Profile
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;
unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_quick_press']);
unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_incoming_links']);
unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_right_now']);
unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_plugins']);
unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_recent_drafts']);
unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_recent_comments']);
@jonschr
jonschr / gist:1a188bfd8f5956af55e5
Created May 1, 2014 21:32
Remove admin bar links
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
.barley_editor_meta_wraper {
top:-50px !important;
}
#barley_editor_controls #barley_editor_insert_after,
#barley_editor_insert {
margin-top:-40px !important;
}
.barley_editor_main {
add_action('genesis_before_sidebar_widget_area','rb_change_genesis_sidebar');
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
@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
jonschr / removeyoutuberelatedvideos
Created July 22, 2014 21:49
Remove related videos from youtube embeds (done via ooembed) in WordPress
//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;
}
/*
* 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';
}
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 )
continue;
$posts = get_posts( 'post_type=events&numberposts=-1' );
$choices = array(
array(
@jonschr
jonschr / Override Genesis Loop
Created December 2, 2014 21:47
Override the Genesis loop (works when using the Grid Loop)
/**
* Use custom content for the loop
*/
function rb_custom_loop() {
while(have_posts()) : the_post();
?>
<article <?php post_class(); ?>>
<?php
$img = genesis_get_image( array( 'format' => 'html', 'size' => genesis_get_option( 'image_size' ), 'attr' => array( 'class' => 'post-image' ) ) );
printf( '%s', $img );