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
sillybean / wp_private_page_filters.php
Last active Mar 7, 2018
Private page filters for WordPress. Related to ticket #8592.
View wp_private_page_filters.php
<?php
/*
Plugin Name: Unpublished Hierarchies
Description: A tiny plugin to allow draft, private, scheduled, and password-protected pages to be selected as parents.
Author: Stephanie Leary
Version: 1.0
Author URI: http://stephanieleary.com
License: GPL2
*/
@sillybean
sillybean / bad-slugs.php
Created Sep 1, 2017
prevent users from saving pages with reserved rewrite rules as slugs
View bad-slugs.php
<?php
// prevent users from saving pages with reserved rewrite rules as slugs
// includes post types, feeds, and search
function my_reserved_slugs() {
return array(
'post',
'attachment',
'category',
@sillybean
sillybean / blockquote-cite-tinymce.php
Last active Aug 1, 2017
Blockquote + Cite TinyMCE button PHP
View blockquote-cite-tinymce.php
<?php
function scl_pullquote_mce_button() {
// check if WYSIWYG is enabled
if ( 'true' == get_user_option( 'rich_editing' ) ) {
add_filter( 'mce_external_plugins', 'scl_pullquote_add_tinymce_plugin' );
add_filter( 'mce_buttons', 'scl_pullquote_register_mce_button' );
// enforce Dashicon font
echo '<style>
.dashicons-testimonial::before {
@sillybean
sillybean / functions.php
Last active Aug 1, 2017
Change post excerpt meta box title and contents
View functions.php
<?php
remove_meta_box( 'postexcerpt', 'post', 'side' );
// use original box:
// add_meta_box('postexcerpt', __( 'Plain Text Summary' ), 'post_excerpt_meta_box', 'post', 'normal', 'high');
// replace box altogether:
add_meta_box( 'postexcerpt', __( 'Plain Text Summary' ), 'custom_post_excerpt_meta_box', 'post', 'normal', 'high' );
function custom_post_excerpt_meta_box( $post ) {
?>
View ao3-tumblr-share.js
(function(){function callback(){(function($){var jQuery=$;
var words = $('dd.words').text();
var length = 'under1';
if ( words > 999 ) {
var kwords = Math.round(words / 1000);
if (kwords >= 100)
length = '100';
@sillybean
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
<?php
function mysites_network_dashboard_widget_setup() {
add_meta_box(
'dashboard_mysites_widget',
'My Sites',
'dashboard_mysites_widget',
'dashboard',
'side',
'high'
@sillybean
sillybean / posts-page-warning.php
Last active Oct 18, 2016
Warn users not to edit the post container
View posts-page-warning.php
<?php
// Add to functions.php or place in mu-plugins
// Admin Notice on Posts Page
add_action( 'admin_notices', 'scl_postspage_print_notices' );
function scl_postspage_print_notices() {
$screen = get_current_screen();
if ( $screen->parent_base != 'edit' || $screen->base != 'post' || $_REQUEST['action'] != 'edit' )
return;
View livewhale-calendar-widget.php
<?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: http://stephanieleary.com
*/
// initialize all custom widgets
@sillybean
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
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
<?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;
}
You can’t perform that action at this time.