Skip to content

Instantly share code, notes, and snippets.

View pingram3541's full-sized avatar

pingram3541 pingram3541

View GitHub Profile
@pingram3541
pingram3541 / functions.php
Created April 26, 2016 00:17
Global remove all scripts and styles
<?php
function pm_remove_all_scripts() {
global $wp_scripts;
$wp_scripts->queue = array();
}
add_action('wp_print_scripts', 'pm_remove_all_scripts', 100);
function pm_remove_all_styles() {
global $wp_styles;
@pingram3541
pingram3541 / functions.php
Created April 26, 2016 00:29
Display last query using ?show_query=true
<?php
/*******************************************************************
* as seen on - https://www.youtube.com/watch?v=oWXjVUcPSPk
* by: Tom McFarlin
********************/
add_filter( 'posts_request', 'my_show_query' );
function my_show_query( $query ){
if ( isset( $_GET['show_query'] ) && 'true' === $_GET['show_query'] ) {
var_dump( $query );
@pingram3541
pingram3541 / page.php
Last active January 28, 2018 10:22
How to restrict betheme content for paid membership pro - copy to child theme
<?php
/**
* The template for displaying all pages.
*
* @package Betheme
* @author Muffin group
* @link http://muffingroup.com
*/
get_header();
@pingram3541
pingram3541 / functions.php
Created June 13, 2016 16:02
Override iCustomize scripts and styles on front end - use this after going live to remove iCustomize dependency and load local theme scripts/styles instead
/* ---------------------------------------------------------------------------
* Override iCustomize on front end - Must be iCustomize V
* --------------------------------------------------------------------------- */
if( ! defined( 'ICUSTOMIZE_OVERRIDE' ) ){
/*
* 1. uncomment to override icustomize scripts on front end
* 2. set to true to load scripts from child theme using function below
***************************************/
@pingram3541
pingram3541 / functions.php
Created September 19, 2016 00:36
Paid Membership Pro - Series: Drip-Feed Content Add-On Shortcode
/*********************************************
* Add custom PMP series drip menu shortcode
*
* Use: [pmp-series-list]
* *******************************************/
add_shortcode( 'pmp-series-list', 'pmp_series_list_shortcode' );
function pmp_series_list_shortcode( $atts ) {
// Attributes - future maybe?
$atts = shortcode_atts(
@pingram3541
pingram3541 / frontend.php
Created October 26, 2016 02:43
Elementor content conforms to page assigned Paid Memberships Pro membership levels - /elementor/includes/frontend.php L315
public function apply_builder_in_content( $content ) {
if ( ! $this->_is_frontend_mode )
return $content;
$post_id = get_the_ID();
if ( post_password_required( $post_id ) )
return $content;
$data = Plugin::instance()->db->get_plain_editor( $post_id );
$edit_mode = Plugin::instance()->db->get_edit_mode( $post_id );
@pingram3541
pingram3541 / wp-smootstate.js
Created January 22, 2017 20:15
WordPress smoothstate implementation
(function($){
'use strict';
/*
* jQuery htmlDoc "fixer" - v0.2pre - 8/8/2011
* http://benalman.com/projects/jquery-misc-plugins/
*
* Copyright (c) 2010 "Cowboy" Ben Alman
* Dual licensed under the MIT and GPL licenses.
@pingram3541
pingram3541 / pmpro_filter_email.php
Created January 30, 2017 21:06
PMPro filter emails
/*********************************************
* OVERRIDE - Disable initial "new content" outgoing email
*
* Members have access to intial drip content, the disables the intial "you have new content" email
* *******************************************/
function gfc_pmpro_email_filter($email) {
//Only continue for "new_content" template emails.
if($email->template != 'new_content')
return $email;
@pingram3541
pingram3541 / pmpro_disable_billing_notifications.php
Created March 24, 2017 00:19
Paid Memberships Pro - Disable Billing Email Templates based on User Setting
<?php
/*********************************************
* ADDON - Add user meta to profile pages
* Adds option to disable PMPro invoice/billing emails
*
* OVERRIDE - Disable PMPro billing emails per user
* Disable billing emails if user meta gfc_disable_billing_notice = Yes
********************************************/
add_action( 'show_user_profile', 'gfc_pmpro_membership_disable_billing' );
add_action( 'edit_user_profile', 'gfc_pmpro_membership_disable_billing' );
@pingram3541
pingram3541 / top-menu.css
Created February 16, 2018 23:45
Custom css for Top Menu example / demo - https://wplovr.com/top-menu/
.elementor-1358 .elementor-element.elementor-element-0363c10{background-color:transparent;background-image:linear-gradient(180deg, #002a44 80%, rgba(0,42,68,0.6) 100%);transition:background 0.3s, border 0.3s, border-radius 0.3s, box-shadow 0.3s;padding:200px 0px 0px 0px;z-index:2;}.elementor-1358 .elementor-element.elementor-element-0363c10 > .elementor-background-overlay{transition:background 0.3s, border-radius 0.3s, opacity 0.3s;}.elementor-1358 .elementor-element.elementor-element-da8f549 > .elementor-column-wrap > .elementor-widget-wrap > .elementor-widget:not(:last-child){margin-bottom:0px;}.elementor-1358 .elementor-element.elementor-element-da8f549 > .elementor-element-populated{transition:background 0.3s, border 0.3s, border-radius 0.3s, box-shadow 0.3s;padding:0px 0px 0px 0px;}.elementor-1358 .elementor-element.elementor-element-da8f549 > .elementor-element-populated > .elementor-background-overlay{transition:background 0.3s, border-radius 0.3s, opacity 0.3s;}.elementor-1358 .elementor-element.eleme