Skip to content

Instantly share code, notes, and snippets.

@ArtfulPussycat
ArtfulPussycat / mu-plugin.php
Created March 18, 2017 22:00
MU-Plugin boilerplate
<?php
/**
* Plugin Name: Your Functionality MU-Plugin Name
* Plugin URI: http://example.com/plugin-name-uri/
* Description: This is a short description of what the plugin does. It's displayed in the WordPress admin area.
* Version: 1.0.0
* Author: Your Name or Your Company
* Author URI: http://example.com/
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
@ArtfulPussycat
ArtfulPussycat / styles.css
Created December 30, 2016 22:45
DIVI Static/Fixed menu
/** Fixed Mobile Menu **/
@media (max-width: 980px) {
.et_non_fixed_nav.et_transparent_nav #main-header, .et_non_fixed_nav.et_transparent_nav #top-header, .et_fixed_nav #main-header, .et_fixed_nav #top-header {
position: fixed !important; } }
.et_mobile_menu {
overflow: scroll !important;
max-height: 83vh;
}
@ArtfulPussycat
ArtfulPussycat / style.css
Created December 29, 2016 16:14
DIVI - Change Hamburger menu icon color
span.mobile_menu_bar:before {
color: #ffffff !important;
}
@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 / 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 / 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
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
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' ) ) {
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 / allow-multisite
Created November 16, 2016 16:25
Allow Multisite
define('WP_ALLOW_MULTISITE', true);