Skip to content

Instantly share code, notes, and snippets.

@ArtfulPussycat
ArtfulPussycat / 0_reuse_code.js
Last active August 29, 2015 14:15
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@ArtfulPussycat
ArtfulPussycat / delete-multisite
Created November 16, 2016 16:23
delete-multisite
define( 'MULTISITE', true );
define( 'SUBDOMAIN_INSTALL', false );
$base = '/wordpress/';
define( 'DOMAIN_CURRENT_SITE', 'localhost' );
define( 'PATH_CURRENT_SITE', '/wordpress/' );
define( 'SITE_ID_CURRENT_SITE', 1 );
define( 'BLOG_ID_CURRENT_SITE', 1 );
@ArtfulPussycat
ArtfulPussycat / allow-multisite
Created November 16, 2016 16:25
Allow Multisite
define('WP_ALLOW_MULTISITE', true);
RewriteEngine On
RewriteBase /wordpress/
RewriteRule ^index.php$ - [L]
# uploaded files
RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]
# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
@ArtfulPussycat
ArtfulPussycat / functions.php
Last active December 9, 2016 19:27
Hide Jetpack and disable direct access
function ap_remove_jetpack_page( ) {
if ( class_exists( 'Jetpack' ) && !current_user_can( 'manage_options' ) ) {
remove_menu_page( 'jetpack' );
}
}
add_action( 'admin_menu', 'ap_remove_jetpack_page', 999 );
add_action( 'admin_init', 'restrict_page' );
function restrict_page() {
if ( class_exists( 'Jetpack' ) && !current_user_can( 'manage_options' ) ) {
@ArtfulPussycat
ArtfulPussycat / functions.php
Created December 9, 2016 19:18
Hide "News from Modern Tribe" Admin dashboard panel
/*
* Remove "News from Modern Tribe" widget from dashboard
*/
function remove_tribe_dashboard_widget() {
remove_meta_box('tribe_dashboard_widget', 'dashboard', 'normal');
}
add_action('wp_dashboard_setup', 'remove_tribe_dashboard_widget');
@ArtfulPussycat
ArtfulPussycat / functions.php
Created December 9, 2016 19:25
Hide "Visual Composer" Admin menu item in WordPress
function custom_menu_page_removing() {
remove_menu_page('vc-welcome'); //vc
}
add_action( 'admin_menu', 'custom_menu_page_removing' );
@ArtfulPussycat
ArtfulPussycat / functions.php
Last active December 29, 2016 16:15
Clean up DIVI shortcodes when switching to another themeFrom https://divi.space/divi-tutorials/lets-talk-about-removing-the-divi-shortcodes/
function goodbye_divi_shortcode () {
$clean_content = get_the_content();
$clean_content = preg_replace('/\[\/?et_pb.*?\]/','', $clean_content);
return $clean_content;
}
add_filter('the_content', 'goodbye_divi_shortcode', 99, 1);
@ArtfulPussycat
ArtfulPussycat / child-theme-functions.php
Created December 22, 2016 15:04 — forked from lots0logs/child-theme-functions.php
WordPress :: Divi Builder :: Search Module :: Custom Post Types
<?php
function my_remove_default_et_pb_custom_search() {
remove_action( 'pre_get_posts', 'et_pb_custom_search' );
add_action( 'pre_get_posts', 'my_et_pb_custom_search' );
}
add_action( 'wp_loaded', 'my_remove_default_et_pb_custom_search' );
function my_et_pb_custom_search( $query = false ) {
if ( is_admin() || ! is_a( $query, 'WP_Query' ) || ! $query->is_search ) {
@ArtfulPussycat
ArtfulPussycat / style.css
Created December 29, 2016 16:14
DIVI - Change Hamburger menu icon color
span.mobile_menu_bar:before {
color: #ffffff !important;
}