Skip to content

Instantly share code, notes, and snippets.

Avatar

Clifford cliffordp

View GitHub Profile
@cliffordp
cliffordp / shortcodes-anywhere.php
Created Nov 21, 2022
WordPress: Enable shortcodes everywhere
View shortcodes-anywhere.php
<?php
// This snippet: https://gist.github.com/cliffordp/e043ad05880e1616ecfcc653935ad35b
// Post Titles (including Search Results)
add_filter( 'the_title', 'shortcode_unautop' );
add_filter( 'the_title', 'do_shortcode' );
// Text Widgets
add_filter( 'widget_text', 'shortcode_unautop');
add_filter( 'widget_text', 'do_shortcode');
@cliffordp
cliffordp / ghl-open-chat-widget.js
Created Nov 21, 2022
High Level Chat Widget: anything with specified class can open the chat widget -- Demo: https://share.getcloudapp.com/d5uylPyE
View ghl-open-chat-widget.js
// This snippet: https://gist.github.com/cliffordp/927a92f2f2db962673d1deef48a31a0f
jQuery(document).ready( function($) {
// Hide until Chat Widget loads to prevent ineffective clicks.
$( ".open-chat-widget" ).hide();
$(window).one( "LC_chatWidgetLoaded", function() {
const chatWidget = window.leadConnector.chatWidget;
// Show once Chat Widget is loaded.
@cliffordp
cliffordp / functions.php
Created May 20, 2020
GeneratePress: Remove all Google Fonts loading and options.
View functions.php
<?php
/**
* GeneratePress: Remove all Google Fonts loading and options.
*
* @link https://gist.github.com/cliffordp/640ff4586c9a7c9ffe6656ff65326a5e This snippet.
* @link https://share.getcloudapp.com/NQuDXKJm 1min demo that this code works.
* @link https://toolset.com/documentation/adding-custom-code/using-toolset-to-add-custom-code/?aid=5336&affiliate_key=Lsvk04DjJOhq I'm using Toolset to add custom snippets.
*/
toolset_snippet_security_check() or die( 'Direct access is not allowed' );
@cliffordp
cliffordp / appsScript.js
Last active Nov 6, 2022
Google Sheets Custom Functions: Get YouTube Channel ID or Channel Title from a YT Video ID
View appsScript.js
// This code: https://gist.github.com/cliffordp/c953c2e4020935727948afe29bd0f192
// Could use YouTube Service instead: https://developers.google.com/apps-script/advanced/youtube
// https://developers.google.com/youtube/v3/docs
const YouTubeApiKey = '...';
// `=getChannelIdFromVideoId( A1 )`
// Could link if you wish: `="https://www.youtube.com/channel/"&B1`
function getChannelIdFromVideoId( videoId ) {
@cliffordp
cliffordp / functions.php
Created Oct 30, 2022 — forked from tripflex/functions.php
WordPress Remove Filter (remove_filter converted to remove_class_filter) to remove Filter/Action without Class Object access. Works with WordPress 1.2+ (4.7+ support added 9-19-2016)
View functions.php
<?php
/**
* Make sure the function does not exist before defining it
*/
if( ! function_exists( 'remove_class_filter' ) ){
/**
* Remove Class Filter Without Access to Class Object
*
* In order to use the core WordPress remove_filter() on a filter added with the callback
@cliffordp
cliffordp / functions.php
Created Nov 6, 2018
Events Calendar PRO: Add {pro_addl_fields} variable to the tribe_event_inline shortcode.
View functions.php
<?php
/**
* Events Calendar PRO: Add {pro_addl_fields} variable to the tribe_event_inline shortcode.
*
* @see cliff_render_pro_addl_fields_within_inline_shortcode()
*
* @link https://gist.github.com/cliffordp/376e8c204ccd34ec78fbc38d519350ef This snippet.
* @link https://theeventscalendar.com/knowledgebase/embedding-single-events-tribe_event_inline-shortcode/
* @link https://theeventscalendar.com/knowledgebase/pro-additional-fields/
*/
@cliffordp
cliffordp / functions.php
Last active Oct 12, 2022
The Events Calendar and related plugins: Add your own location for template file loading.
View functions.php
<?php
/**
* The Events Calendar and related plugins: Add your own location for template file loading.
*
* Example "Single Event within List View" for Avada theme (which has theme overrides).
* Now tries to load in this order:
* This plugin: /app/public/wp-content/plugins/my-plugin/tribe-events/list/single-event.php
* Theme root so it stays even if switch themes: /app/public/wp-content/themes/tribe-events/list/single-event.php
* Child theme with theme overrides: /app/public/wp-content/themes/Avada-Child-Theme/tribe-events/list/single-event.php
@cliffordp
cliffordp / single-event.php
Last active Oct 5, 2022
Custom PHOTO VIEW to add Organizer and Venue details. -- Place in this location: /wp-content/themes/YOUR_THEME_DIRECTORY/tribe-events/pro/photo/single-event.php -- and delete whatever you do not need or want -- A GIF preview of the result: http://cl.ly/0R2r0Q0F0L03
View single-event.php
<?php
/**
* Photo View Single Event
* This file contains one event in the photo view
*
* @package TribeEventsCalendar
*
*/
if ( ! defined( 'ABSPATH' ) ) {
@cliffordp
cliffordp / functions.php
Last active Sep 27, 2022
Limit Slider Revolution's WP_Query to only include Featured Events that have a featured image
View functions.php
<?php
/**
* Limit Slider Revolution's WP_Query to only include Featured Events that have a featured image
*
* @link https://theeventscalendar.com/knowledgebase/featured-events/
*
* From https://gist.github.com/cliffordp/30ac2152a8264ef27235b46b7d16332d
* Similar code for Essential Grid: https://gist.github.com/cliffordp/a6aad3c60f469970b1ecb209d85ec755
* Same Slider Revolution code except without requirement for being a Featured Event (works for more than just The Events Calendar): https://gist.github.com/cliffordp/9f0d7cc5e86b2a721cd646d953bb1261
*
@cliffordp
cliffordp / functions.php
Last active Sep 23, 2022 — forked from patric-boehner/functions.php
Remove in-post settings for the Genesis Framework, including SEO, layout, and scripts.
View functions.php
<?php
// Remove in-post settings for the Genesis Framework, including SEO, layout, and scripts.
// Relevant Genesis code can be found in theme's lib > admin > inpost-metaboxes.php
if( ! function_exists( 'cliff_genesis_simplify_editing_screens' ) ) {
/**
* Remove in-post Genesis settings by post type.
* @link https://gist.github.com/cliffordp/744a19f00565051924ec7f0d46ac687e This snippet.
*/
function cliff_genesis_simplify_editing_screens() {