Skip to content

Instantly share code, notes, and snippets.

Jeff Sebring jeffsebring

Block or report user

Report or block jeffsebring

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 archgitlab.sh
#!/bin/bash
##########################
## Check if run as root ##
##########################
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root" 1>&2
exit 1
fi
@jeffsebring
jeffsebring / tenup_dont_publish_pulled_post.php
Created Nov 22, 2013
Stop Push Syndication Plugin from Auto Publishing
View tenup_dont_publish_pulled_post.php
<?php
// Remove `publish_pulled_post` hook from `syn_pre_pull_posts` filter during cron
add_filter( 'syn_pre_pull_posts', 'tenup_dont_publish_pulled_post' ), 100 );
function tenup_dont_publish_pulled_post( $posts ) {
// Remove auto publish action
if ( class_exists( 'Syndication_WP_XML_Client' ) )
remove_action( 'syn_post_pull_new_post', array( 'Syndication_WP_XML_Client' , 'publish_pulled_post' ), 10, 5 );
@jeffsebring
jeffsebring / pu01_logged_in_redirect.php
Created Nov 14, 2013
Logged in Home Page Redirect
View pu01_logged_in_redirect.php
<?php
/**
* Logged in Home Page Redirect
**/
add_action( 'template_redirect', 'pu01_logged_in_homepage' );
// Redirect logged in users from home page to admin
function pu01_logged_in_homepage() {
@jeffsebring
jeffsebring / pu01_options_modal_uploader.js
Created Sep 16, 2013
WP 3.5 Options Page Modal Uploader
View pu01_options_modal_uploader.js
jQuery( document ).ready( function() {
function pu01_show_image() {
var pu01_image_1 = jQuery( '#pu01_image_1' ).val(),
pu01_image_2 = jQuery( '#pu01_image_2' ).val(),
pu01_image_3 = jQuery( '#pu01_image_3' ).val();
jQuery( '#pu01_image_1_preview' ).after( '<div id="pu01_image_1_preview_image"><img width="300" height="140" src="' + pu01_image_1 + '" /></div>' );
jQuery( '#pu01_image_2_preview' ).after( '<div id="pu01_image_2_preview_image"><img width="300" height="140" src="' + pu01_image_2 + '" /></div>' );
View pu01_metabox_uploader_modal.html
<script>
var file_frame;
var wp_media_post_id = wp.media.model.settings.post.id;
var set_to_post_id = <?php echo get_the_ID(); ?>;
jQuery('.upload_image_button').on('click', function( event ){
event.preventDefault();
View thumbnail_fallback.php
/**
* Print Selected Thumbnail Images
* @return string|bool thumbnail html or false
*/
function pU01_thumbnail_img( $size = 'secondary_image', $attr = array() ) {
// Fallback to featured image
if ( ! $thumbnail_id = get_post_meta( get_the_ID(), get_post_type() . "_{$size}_thumbnail_id", true ) ) {
if ( ! $thumbnail_id = get_post_meta( get_the_ID(), "_thumbnail_id", true ) )
@jeffsebring
jeffsebring / date-archive-not-found.php
Created Jul 29, 2013
Disable Date Based Archives
View date-archive-not-found.php
<?php
// This will redirect all date based archive to a page that does not exist,
// effectively disabling them, with a 404 error code
add_action( 'template_redirect', 'pu01_date_archive_not_found' );
function pu01_date_archive_not_found() {
if ( is_date() ) {
@jeffsebring
jeffsebring / js_metabox_example.php
Last active Dec 16, 2015
Simple Metabox Example w/ 20 Character Validation Error
View js_metabox_example.php
<?php
/**
* Simple Metabox Example
*
* Validates string is under 20 characters
*
* Copyright (C) 2013 Jeff Sebring <http://jeffsebring.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@jeffsebring
jeffsebring / newp.sh
Created Nov 21, 2012
New WordPress Install with separated directories
View newp.sh
#!/bin/sh
wget http://wordpress.org/latest.tar.gz
tar -zxvf latest.tar.gz
rm latest.tar.gz
mv wordpress __
mv __/wp-content _
echo "<?php" >> index.php
echo "define( 'WP_USE_THEMES', true );" >> index.php
echo "require('./__/wp-blog-header.php');" >> index.php
View hide_dashboard_jazz.php
function js_remove_dashboard_widgets() {
remove_meta_box( 'dashboard_quick_press', 'dashboard', 'side' );
remove_meta_box( 'dashboard_recent_drafts', 'dashboard', 'side' );
remove_meta_box( 'dashboard_primary', 'dashboard', 'side' );
remove_meta_box( 'dashboard_secondary', 'dashboard', 'side' );
remove_meta_box( 'dashboard_plugins', 'dashboard', 'normal' );
remove_meta_box( 'dashboard_incoming_links', 'dashboard', 'normal' );
remove_meta_box( 'dashboard_recent_comments', 'dashboard', 'normal' );
remove_meta_box( 'dashboard_incoming_links', 'dashboard', 'normal' );
You can’t perform that action at this time.