Skip to content

Instantly share code, notes, and snippets.

@nathaningram
nathaningram / enable-bvb-svgs.php
Created April 7, 2022 19:56
Enable SVG Uploads in Beaver Builder Modules
// Enable SVG Uploads in Beaver Builder Modules
add_filter( 'fl_module_upload_regex', function( $regex, $type, $ext, $file ) {
$regex['photo'] = '#(jpe?g|png|gif|bmp|tiff?|svg)#i';
return $regex;
}, 10, 4 );
@nathaningram
nathaningram / remove-slug.php
Created April 7, 2022 19:55
Remove Slug from CPT URLs
//Removes Slugs from CPT URLs
function na_remove_slug( $post_link, $post, $leavename ) {
if ( 'linked_article' != $post->post_type || 'publish' != $post->post_status ) {
return $post_link;
}
$post_link = str_replace( '/' . $post->post_type . '/', '/', $post_link );
@nathaningram
nathaningram / layout.htm
Created March 30, 2022 19:28
Events Calendar Custom Layout
<div class="event-wrapper">
<a class="event-link" href="[wpbb post:url]">
<div class="event-date-outer-wrapper mobilehide">
<div class="event-date-wrapper">
<div class="event-month">
[wpbb post:the_events_calendar_start_date format='M']
</div>
<div class="event-day">
[wpbb post:the_events_calendar_start_date format='j']
</div>
@nathaningram
nathaningram / behind-the-site.php
Last active April 1, 2022 20:54
Behind the Site Code Snippets
////////// Snippets from Behind the Site March 2022 //////////
// Add to the functions.php of your active child theme or a custom functions plugin
/////////////// WooCommerce Modifications ///////////////
//Show FREE rather than $0.00
//Source: https://www.businessbloomer.com/woocommerce-display-free-instead-0-00-empty-price/
@nathaningram
nathaningram / behind-the-site.css
Last active April 2, 2022 20:58
Behind the Site CSS
/***************** CSS from Behind The Site, March 2022 *****************/
/* Typography */
.fl-rich-text p { /* Removes Kadence top p margin */
margin-top:0 !important;
}
.fl-rich-text p:last-child { /*removes margin at bottom of BvB text modules */
margin-bottom: 0;
@nathaningram
nathaningram / thisguy.js
Created January 16, 2022 14:43
Reveal Element Causing Horizontal Scroll
document.querySelectorAll('*').forEach(el => {
if (el.offsetWidth > document.documentElement.offsetWidth) {
console.log('Hold Up - This Guy Sucks ->: ', el);
}
});
@nathaningram
nathaningram / hide-tec.php
Created January 7, 2022 15:41
Hide The Events Calendar Fields in Admin
// Hide The Events Calendar Fields in Admin
add_action('admin_head', 'bww_hide_tec_field_groups');
function bww_hide_tec_field_groups() {
echo '<style>
#event_tribe_venue,#event_tribe_organizer,#event_url,#event_cost {display:none !important;}
</style>';
}
@nathaningram
nathaningram / kadence-dash.php
Last active December 17, 2021 17:24
WP Dashboard Widget from Kadence Element (experimental)
//Add Kadence Dashboard Widget
function ni_register_kadence_dashboard_widget() {
wp_add_dashboard_widget(
'custom_dashboard_widget',
'Welcome to Your Website', //Title for Dashboard Widget
'ni_custom_dashboard_widget_content'
);
}
function ni_kadence_dashboard_widget_content() {
echo do_shortcode('[kadence_element id="104"]'); //Add your shortcode here
@nathaningram
nathaningram / no-signup-renewals.php
Created November 22, 2021 19:41
RCP No Signup Fee on Renewals
// RESTRICT CONTENT - Disable signup fee for renewals.
// This is for debugging - do not use if you're just looking at my gists.
function ag_rcp_disable_signup_fee_renewals( $fee_args, $registration ) {
// Bail if this isn't a signup fee.
if ( 'Signup Fee' != $fee_args['description'] && 'Signup Credit' != $fee_args['description'] ) {
return $fee_args;
}
@nathaningram
nathaningram / my-custom-functions.php
Last active April 2, 2022 20:09
Kadence Starter Site 2021 Custom Functions Plugin
<?php
/*
Plugin Name: My Awesome Custom Functions Plugin
Plugin URI: https://nathaningram.com
Description: A set of custom functions for client websites from Nathan Ingram's Page Builder Developer Course Nov 2020
Version: 1.0
Author: Nathan Ingram
Author URI: https://nathaningram.com
License: GPL2
*/