Instantly share code, notes, and snippets.

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
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 );
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() {
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 ) )
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() ) {
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
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' );