Skip to content

Instantly share code, notes, and snippets.

@nathaningram
nathaningram / sir.php
Created March 24, 2025 13:37
Smart Image Resize (SIR) - exclude image sizes from being altered
// Exclude Image Sizes from SIR Plugin
// List all sizes to be excluded in the list below
add_filter('wp_sir_exclude_sizes', function() {
return [
'woocommerce_gallery_thumbnail',
'thumbnail',
'medium',
'medium_large',
'large',
'news_grid',
@nathaningram
nathaningram / stupidity.css
Created February 27, 2025 19:49
Avada Columns
/* Responsive grid for portfolio layout */
.fusion-portfolio-wrapper {
display: grid;
grid-template-columns: repeat(3, 1fr); /* 3 columns on large screens */
gap: 20px;
justify-content: center;
align-items: start;
}
/* Responsive adjustments for tablets (768px and up) */
@nathaningram
nathaningram / looker-shortcode.php
Created December 18, 2024 16:50
Starter Site 2024 Course - MU Looker Dashboard iFrame
//////////////////////////////////////////////////////////////////////////////
// Looker Dashboard Iframe Shortcode
//////////////////////////////////////////////////////////////////////////////
// Function to generate the iframe HTML
function bww_looker_dashboard_shortcode() {
// Retrieve the fields from the Meta Box settings page
$all_options = get_option('site-info');
$iframe_height = $all_options['bww_looker_iframe_height'] ?? '';
$iframe_src = $all_options['bww_site_looker'] ?? '';
@nathaningram
nathaningram / mu-brilliant-dashboard.php
Last active December 18, 2024 16:25
Starter Site 2024 Course - Brilliant Dashboard
<?php
/*
Plugin Name: Brilliant Dashboard
Description: Custom Dashboard Replacement with iFrame
Version: 2024.12
Author: Brilliant Web Works
*/
// Prevent direct access
if (!defined('ABSPATH')) {
@nathaningram
nathaningram / editor-cleanup.php
Created December 17, 2024 17:32
Editor User Admin Cleanup
// Remove Tools and Kadence Menus for Editors
function ni_remove_tools_kadence_for_editors() {
if (current_user_can('editor') && !current_user_can('administrator')) {
// Remove 'Tools' Menu (default WordPress)
remove_menu_page('tools.php');
// Remove 'Kadence' Menu (from Kadence Blocks)
remove_menu_page('kadence-blocks');
}
}
@nathaningram
nathaningram / business-hours-table.php
Created December 16, 2024 17:12
Site Info - Output Business Hours in Table - Starter Site 2024
//////////////////////////////////////////////////////////////////////////////
// Display Business Hours in a Table
// usage [business-hours]
//////////////////////////////////////////////////////////////////////////////
// Shortcode to display business hours
function bww_business_hours_shortcode() {
// Retrieve the business hours from the Meta Box settings page
$all_options = get_option('site-info');
@nathaningram
nathaningram / clickable-phone.php
Last active December 16, 2024 17:23
Site Info - Clickable Phone Number Shortcode - Starter Site 2024
//////////////////////////////////////////////////////////////////////////////
// Clickable Main Phone Number from Site Info
// usage [phone]
//////////////////////////////////////////////////////////////////////////////
function bww_phone_shortcode() {
// Retrieve phone fields from the Meta Box settings page
$all_options = get_option('site-info');
$phone_number = $all_options['bww_info_phone'] ?? '';
@nathaningram
nathaningram / dynamic-copyright.php
Created December 16, 2024 17:11
Site Info - Dynamic Copyright Date - Starter Site 2024
@nathaningram
nathaningram / gf-default-email.php
Created December 16, 2024 17:10
Site Info - GF Default Email - Starter Site 2024
//////////////////////////////////////////////////////////////////////////////
// Change Default GF Send To Email to the one in Site Info
//////////////////////////////////////////////////////////////////////////////
add_filter('gform_notification', function ($notification, $form, $entry) {
// Retrieve the replacement email from the Meta Box settings
$all_options = get_option('site-info');
$replacement_email = $all_options['bww_info_form_email'] ?? '';
@nathaningram
nathaningram / ga-gsc-gtm.php
Last active December 19, 2024 20:23
Site Info - GA, GSC, & GTM - Starter Site 2024
//////////////////////////////////////////////////////////////////////////////
// Add GA, GSC, and GTM Code to <head>
// and GTM Code to <body> from Site Settings
//////////////////////////////////////////////////////////////////////////////
// Add code to the <head>
add_action('wp_head', function () {
// Retrieve the fields from the Meta Box settings page
$all_options = get_option('site-info');
$ga_tag = $all_options['bww_info_ga_tag'] ?? '';