Skip to content

Instantly share code, notes, and snippets.

View schutzsmith's full-sized avatar

Daniel Schutzsmith schutzsmith

View GitHub Profile
@schutzsmith
schutzsmith / custom-provision.sh
Created April 24, 2016 00:50 — forked from neilgee/custom-provision.sh
Custom VVV Variable Provisioning for WordPress sites
# #!/bin/bash
# #
# # provision.sh
# #
# # This file is specified in Vagrantfile and is loaded by Vagrant as the primary
# # provisioning script whenever the commands `vagrant up`, `vagrant provision`,
# # or `vagrant reload` are used. It provides all of the default packages and
# # configurations included with Varying Vagrant Vagrants.
# # By storing the date now, we can calculate the duration of provisioning at the

Keybase proof

I hereby claim:

  • I am schutzsmith on github.
  • I am schutzsmith (https://keybase.io/schutzsmith) on keybase.
  • I have a public key whose fingerprint is C109 8607 AD05 D24F 139F 65A3 87C0 5517 5518 A2A5

To claim this, I am signing this object:

#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/
<?php
/**
* Find Shortcode
*
*/
function be_find_shortcode( $atts = array() ) {
$atts = shortcode_atts( array(
'shortcode' => '',
@schutzsmith
schutzsmith / removewidgets.php
Created April 14, 2019 05:10
Remove unnecessary dashboard widgets in WordPress
// remove unnecessary dashboard widgets
function remove_dashboard_widgets(){
global $wp_meta_boxes;
// only remove "Right Now" for non-administrators
if (!current_user_can('activate_plugins')) {
unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_right_now']);
}
@schutzsmith
schutzsmith / removemetaboxes.php
Last active April 14, 2019 05:12
remove unnecessary page post meta boxes in WordPress
// remove unnecessary page/post meta boxes
function remove_meta_boxes() {
// posts
remove_meta_box('postcustom','post','normal');
remove_meta_box('trackbacksdiv','post','normal');
remove_meta_box('commentstatusdiv','post','normal');
remove_meta_box('commentsdiv','post','normal');
remove_meta_box('categorydiv','post','normal');
remove_meta_box('tagsdiv-post_tag','post','normal');
@schutzsmith
schutzsmith / removemenus.php
Created April 14, 2019 05:12
remove unnecessary menus in WordPress
// remove unnecessary menus
function remove_admin_menus () {
global $menu;
// all users
$restrict = explode(',', 'Links,Comments');
// non-administrator users
$restrict_user = explode(',', 'Media,Profile,Users,Tools,Settings');
@schutzsmith
schutzsmith / removeupdates.php
Created April 14, 2019 05:13
Remove WordPress Updates Notification
// remove update notifications
<?php
function no_update_notification() {
if (!current_user_can('activate_plugins')) remove_action('admin_notices', 'update_nag', 3);
}
add_action('admin_notices', 'no_update_notification', 1);
@schutzsmith
schutzsmith / createshortcode.php
Created April 14, 2019 05:14
Create Shortcode in WordPress
// include a specific PHP file
function customIncludeFile($params = array()) {
extract(shortcode_atts(array(
'file' => 'contact-form'
), $params));
ob_start();
include(get_theme_root() . '/' . get_template() . "/$file.php");
return ob_get_clean();
@schutzsmith
schutzsmith / removeadminbar.php
Created April 14, 2019 05:15
Remove Admin Bar in WordPress
// remove admin bar
add_filter('show_admin_bar', '__return_false');