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: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 / 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 / field_upload.js
Last active December 6, 2016 18:21
BeTheme Muffin Options - Upload Field - Src Path to Relative URL
function MfnUpload(){
(function($) {
jQuery( 'img[src=""]' ).attr( 'src', mfn_upload.url );
jQuery( '.mfn-opts-upload' ).click( function( event ) {
event.preventDefault();
var activeFileUploadContext = jQuery( this ).parent();
var type = jQuery( 'input', activeFileUploadContext ).attr( 'class' );
@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 / 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 / single-elementor_library.php
Last active February 21, 2018 18:24
Used in theme functions.php - set Elementor Library post type to use built-in Canvas template by default
/* ---------------------------------------------------------------------------
* Force Elementor Library to use Canvas Template
* - this gist file name can also be used in your theme to override the template instead of this
* --------------------------------------------------------------------------- */
function get_elementor_library_post_type_template( $single_template ) {
global $post;
if ($post->post_type == 'elementor_library') {
$single_template = WP_PLUGIN_DIR . '/elementor/includes/page-templates/canvas.php';
}
@pingram3541
pingram3541 / functions.php
Created September 19, 2018 20:30
Widget - Switch Map based on post's ACF values
/**
* add custom widget to switch city page map preferences
*
* Simply performs an audit on City Pages to check if
* the preference is to output custom code or use the
* automatic map search by city name
*
**/
class Custom_City_Map_Widget extends WP_Widget {
@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