Skip to content

Instantly share code, notes, and snippets.

@jaygidwitz
jaygidwitz / functions.php
Created September 25, 2017 18:34
MonsterInsights logout
/**
* Defines a logout link for a WP nav menu item, if that menu item has href="{someurl}?logout=1"
*
* @param array $items Menu Items
* @param array $args Arguments
* @return items Menu Items
*/
function monsterinsights_logout_links( $items, $args ) {
if ( ! empty( $items ) && is_array( $items ) ) {
foreach( $items as $key => $item ){
@jaygidwitz
jaygidwitz / monsterinsights.php
Last active November 8, 2017 15:55
deqeue chart.js from imagify and weDevs wp-project-manager
function custom_monsterinsights_remove_conflicting_asset_files() {
// Get current screen.
$screen = get_current_screen();
// Bail if we're not on a MonsterInsights screen.
if ( empty( $screen->id ) || strpos( $screen->id, 'monsterinsights' ) === false ) {
return;
}
$styles = array();
### Keybase proof
I hereby claim:
* I am jaygidwitz on github.
* I am jaygidwitz (https://keybase.io/jaygidwitz) on keybase.
* I have a public key ASDZTnlotnjaALdO4w0mmwo6WqW4gTY3bYuUDmecQF_2DAo
To claim this, I am signing this object:
@jaygidwitz
jaygidwitz / monsterinsights.php
Last active February 23, 2018 18:50 — forked from chriscct7/monsterinsights.php
Remove conflicting styles/scripts from MI pages Ken Theme by artbees
<?php
/*
Plugin Name: Ken Theme Conflict Fix for MonsterInsights
Plugin URI:
Description: Fixes conflict with Ken Theme on MonsterInsights admin pages
Version: 1.0.0
Author: MonsterInsights Support Team
Author URI: https://www.monsterinsights.com
License:
License URI:
@jaygidwitz
jaygidwitz / monsterinsights.php
Created March 14, 2018 21:06
monsterinsights-vitrine-fix
<?php
/*
Plugin Name: Vitrine Conflict Fix for MonsterInsights
Plugin URI:
Description: Fixes conflict with Vitrine Theme on MonsterInsights admin pages
Version: 1.0.0
Author: MonsterInsights Support Team
Author URI: https://www.monsterinsights.com
License:
License URI:
@jaygidwitz
jaygidwitz / monsterinsights-wp-project-manager.php
Last active March 21, 2018 16:49
Fixes conflict with WP Project Manager on MonsterInsights admin pages
<?php
/*
Plugin Name: WP Project Manager Fix for MonsterInsights
Plugin URI:
Description: Fixes conflict with WP Project Manager on MonsterInsights admin pages
Version: 1.0.0
Author: MonsterInsights Support Team
Author URI: https://www.monsterinsights.com
License:
License URI:
@jaygidwitz
jaygidwitz / monsterinsights-nayma-theme.php
Last active March 22, 2018 22:01
Fixes conflict with Nayma on MonsterInsights admin pages
<?php
/*
Plugin Name: MonsterInsights Fix for Nayma Theme
Plugin URI:
Description: Fixes conflict with Nayma on MonsterInsights admin pages
Version: 1.0.0
Author: MonsterInsights Support Team
Author URI: https://www.monsterinsights.com
License:
License URI:
@jaygidwitz
jaygidwitz / church-suite-fix-for-MonsterInsights.php
Last active April 5, 2018 17:30
Church Suite by Webnus Fix for MonterInsights Plugin
<?php
/*
Plugin Name: MonsterInsights Fix for Church Suite Theme by Webnus
Plugin URI:
Description: Fixes conflict with Church Theme on MonsterInsights Admin pages
Version: 1.0.0
Author: MonsterInsights Support Team
Author URI: https://www.monsterinsights.com
License:
License URI:
@jaygidwitz
jaygidwitz / monsterinsights-dimensions-userrole.php
Created March 15, 2019 15:39
logged in user role custom dimension
<?php
/**
* Plugin Name: MonsterInsights User Role Dimension
* Description: Add a user role to the dimensions options in MonsterInsights.
* Version: 1.0.0
* Author: MonsterInsights Support Team
* Author URI: https://www.monsterinsights.com
*/
function monsterinsights_add_user_role_to_dimensions( $dimensions ) {
@jaygidwitz
jaygidwitz / functions.php
Created August 16, 2019 15:11 — forked from mikejolley/functions.php
WooCommerce - Redirect external products offsite (disable single listings)
<?php // Do not include this if already open!
/**
* Code goes in theme functions.php.
*/
add_action( 'template_redirect', 'redirect_external_products' );
function redirect_external_products() {
global $post;