Skip to content

Instantly share code, notes, and snippets.

Stephanie Leary sillybean

Block or report user

Report or block sillybean

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
sillybean / png_quality_filter.php
Last active Sep 13, 2019
Filter PNG image quality in WordPress
View png_quality_filter.php
// well-known filter to change JPG quality:
add_filter( 'jpeg_quality', function( $arg ){ return 100; } );
// lesser-known filter to change quality for any image type:
add_filter( 'wp_editor_set_quality', 'any_image_quality', 10, 2 );
add_filter( 'jpeg_quality', 'any_image_quality' );
function any_image_quality( $default_quality, $mime_type = NULL ) {
sillybean / print-acf-field-group.php
Created Jul 29, 2019
Print all ACF fields in a group with labels and values
View print-acf-field-group.php
$fields = array();
$field_group = get_page_by_title( 'GROUP TITLE HERE', OBJECT, 'acf-field-group' );
if ( is_object( $field_group ) ) {
$acf_fields = acf_get_fields_by_id( $field_group->ID );
$fields = wp_list_pluck( $acf_fields, 'label', 'name' );
foreach ( $fields as $field_name => $field_label ) {
sillybean / userstyles.css
Last active Jul 19, 2019
Hide new Twitter's right sidebar full of crap
View userstyles.css
.r-1ovo9ad div {
width: 0px !important;
.r-1ovo9ad div div.r-1oszu61 {
width: 360px !important;
.r-1ovo9ad form div {
width: inherit !important;
sillybean / tinymce-widget-styleselect.txt
Created Sep 5, 2017
Customizing TinyMCE's Formats (style_select) dropdown in rich text widgets in WordPress 4.8x
View tinymce-widget-styleselect.txt
// PHP goes in functions.php or similar
// Callback function to filter the MCE settings
function my_mce_style_options( $init_array ) {
// Define the style_formats array
$style_formats = my_mce_styleselect_options();
// Insert the array, JSON ENCODED, into 'style_formats'
$init_array['style_formats'] = json_encode( $style_formats );
sillybean / bad-slugs.php
Created Sep 1, 2017
prevent users from saving pages with reserved rewrite rules as slugs
View bad-slugs.php
// prevent users from saving pages with reserved rewrite rules as slugs
// includes post types, feeds, and search
function my_reserved_slugs() {
return array(
sillybean / dashboard-my-sites.php
Created Jan 23, 2017
My Sites Dashboard widget to show all user's sites on network
View dashboard-my-sites.php
function mysites_network_dashboard_widget_setup() {
'My Sites',
View livewhale-calendar-widget.php
Plugin Name: LiveWhale Calendar Widget (TAMU)
Description: WordPress widget to display events from a LiveWhale calendar feed.
Author: Stephanie Leary
Version: 1.0
Author URI:
// initialize all custom widgets
sillybean / termlink-filters.php
Last active Oct 17, 2016
add post_type arg to term links (narrow down the query)
View termlink-filters.php
sillybean / dashboard-login-redirect.php
Created Oct 17, 2016
Redirect to top-level dashboard (instead of profile) if not superadmin or not allowed on this blog
View dashboard-login-redirect.php
add_filter( 'login_redirect', 'scl_network_dashboard_login_redirect', 100, 3 );
function scl_network_dashboard_login_redirect( $redirect_to, $request_redirect_to, $user ) {
if ( !is_user_member_of_blog() || ( is_main_site() && !is_super_admin() ) )
return network_admin_url();
return $redirect_to;
View archive-people.php
add_action( 'genesis_loop', 'scl_people_types_loop', 10 );
remove_action( 'genesis_loop', 'genesis_do_loop' );
function scl_people_types_loop( $parent = 0 ) {
$terms = get_terms( array(
'taxonomy' => 'people_type',
'hide_empty' => true,
'parent' => $parent,
) );
You can’t perform that action at this time.