Skip to content

Instantly share code, notes, and snippets.

@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();
@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 / functions.php
Created June 15, 2016 19:32
for raise you vibraitons
<?php // Custom widgets above category pages for pinterest style blog.
/** Register widget areas */
genesis_register_sidebar( array(
'id' => 'cta-1',
'name' => __( 'Call to Action #1', 'mp' ),
'description' => __( 'This is the call to action section.', 'mp' ),
) );
genesis_register_sidebar( array(
'id' => 'cta-2',
@jaygidwitz
jaygidwitz / functions.php
Created June 15, 2016 19:29
Add search to secondary nav
<?php // do not include
// Add Search to Secondary Nav
add_filter( 'wp_nav_menu_items', 'genesis_search_primary_nav_menu', 10, 2 );
function genesis_search_primary_nav_menu( $menu, stdClass $args ){
if ( 'primary' != $args->theme_location )
return $menu;
if( genesis_get_option( 'nav_extras' ) )
return $menu;
$menu .= sprintf( '<li class="search icon menu-item"><i class="fa fa-search"></i></li> <li id="menu-item-4439204" class="custom-search menu-item">%s</li>', __( genesis_search_form( $echo ) ) );
@jaygidwitz
jaygidwitz / functions.php
Last active June 15, 2016 19:13
Add SI Feed To Site
/**
* Register all dashboard metaboxes
*
* @access public
* @since 1.0
* @return void
*/
function rc_mdm_register_widgets() {
global $wp_meta_boxes;
@jaygidwitz
jaygidwitz / hello.php
Last active June 15, 2016 18:33
Hello, Lovecraft. Displays quote by H. P. Lovecraft in the upper right hand corner of the wordpress admin. Created for http://necronomicon-providence.com
<?php
/**
* @package Hello_Lovecraft
* @version 1.6
*/
/*
Plugin Name: Hello Lovecraft
Plugin URI: http://wordpress.org/extend/plugins/hello-lovecraft/
Description: This is not just a plugin, it symbolizes the despair and cosmic horror of an entire species summed up by H. P. Lovecraft: "Ph'nglui mglw'nafh Cthulhu R'lyeh wgah'nagl fhtagn”. When activated you will randomly see quote from <cite>Lovecraft</cite> in the upper right of your admin screen on every page.
Author: Studio Issa
//For Teas Page Squibbs Iced Teas http://squibbs.studioissa.com/our-teas/
// Add Shortcode
function teas_insert_shortcode_first( $atts ) {
// Attributes
extract( shortcode_atts(
array(
'img' => '',
'title' => '',
'desc' => '',
@jaygidwitz
jaygidwitz / functions.php
Created June 15, 2016 18:13
Home Box Shortcode
// Add homebox Shortcode
function homebox_shortcode( $atts , $content = null ) {
// Attributes
extract( shortcode_atts(
array(
'boxclass' => '',
'link' => '',
'title' => '',
'img' => '',
@jaygidwitz
jaygidwitz / functions.php
Created June 15, 2016 18:03
Add custom lightbox attribute to menu item optin monster.
/* Add custom lightbox attribute to the menu Optin Monster
*/
function prefix_menu_item_extra_atts( $atts, $item, $args )
{
if ( $item->object_id == '652') {
$atts['data-optin-slug'] = 'uc20zebirdm018gi';
$atts['class'] = 'manual-optin-trigger';
}
@jaygidwitz
jaygidwitz / Genesis Theme Call To Action Widget Below Header, Changes Depending on page.php
Last active June 14, 2016 22:33
Genesis Theme Call To Action Widget Below Header, Changes Depending on page
/**
* Add CTA widget support for site. If widget not active, don't display
* Modified from http://www.carriedils.com/add-widget-area-below-nav/
*/
function mp_cta_genesis() {
// Don't display the CTA on the home page, since it's built into the MP theme
if ( is_home() || is_page('blog') || is_archive() ) {
return;
}