Skip to content

Instantly share code, notes, and snippets.

@SitesByYogi
SitesByYogi / airtable.php
Created June 9, 2025 03:17
Airtable webhook template
<?php
add_action('wpforms_process_complete', 'send_wpforms_to_airtable', 10, 4);
function send_wpforms_to_airtable($fields, $entry, $form_data, $entry_id) {
// Target only one form
if ($form_data['id'] != 123) return; // Change 123 to your form ID
$airtable_token = 'YOUR_AIRTABLE_TOKEN';
$base_id = 'YOUR_BASE_ID';
const options = {
componentRestrictions: { country: "us" },
bounds: new google.maps.LatLngBounds(
new google.maps.LatLng(25.8371, -106.6456), // Southwest TX
new google.maps.LatLng(36.5007, -93.5080) // Northeast TX
),
strictBounds: false
};
<?php
function enqueue_google_maps_autocomplete() {
if (is_page('your-form-page-slug')) { // Optional: limit to the form page
?>
<script src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&libraries=places"></script>
<script>
function initAutocomplete() {
const input = document.querySelector('.autocomplete-address');
if (!input) return;
@SitesByYogi
SitesByYogi / booking-cal.php
Created January 3, 2025 13:22
Booking Calendar Code
<?php
// Enqueue necessary scripts and styles for the booking calendar
function booking_calendar_assets() {
wp_enqueue_script('moment-js', 'https://cdn.jsdelivr.net/npm/[email protected]/moment.min.js', [], null, true);
wp_enqueue_script('fullcalendar-js', 'https://cdn.jsdelivr.net/npm/[email protected]/main.min.js', ['moment-js'], null, true);
wp_enqueue_style('fullcalendar-css', 'https://cdn.jsdelivr.net/npm/[email protected]/main.min.css', [], null);
wp_add_inline_script(
'fullcalendar-js',
@SitesByYogi
SitesByYogi / sprout-error.h
Created December 30, 2024 17:10
Sprout Error
[29-Dec-2024 03:31:22 UTC] PHP Warning: Undefined variable $offset in /home/billing3/public_html/wp-content/plugins/sprout-invoices-pro/bundles/sprout-invoices-addon-dynamic-text/inc/Dynamic_Text.php on line 81
[29-Dec-2024 03:31:22 UTC] PHP Warning: Undefined variable $offset in /home/billing3/public_html/wp-content/plugins/sprout-invoices-pro/bundles/sprout-invoices-addon-dynamic-text/inc/Dynamic_Text.php on line 81
[29-Dec-2024 04:23:38 UTC] PHP Warning: Undefined variable $option in /home/billing3/public_html/wp-content/plugins/sprout-invoices-addon-auto-billing/controllers/Sprout_Billings_Admin.php on line 322
[29-Dec-2024 04:23:38 UTC] PHP Fatal error: Uncaught Error: Call to undefined method SA_AuthorizeNet::create_transaction() in /home/billing3/public_html/wp-content/plugins/sprout-invoices-addon-auto-billing/payment-processors/authorize-net-cim/sprout-billings-authorizenet-cim.php:808
Stack trace:
#0 /home/billing3/public_html/wp-content/plugins/sprout-invoices-addon-auto-billing/payment-process
@SitesByYogi
SitesByYogi / list-product-urls.php
Created December 27, 2024 12:04
Creates a list of all published product URLs on your Website
<?php
function list_all_product_and_category_urls() {
// Get all products
$products = wc_get_products(array(
'limit' => -1, // Retrieve all products
'status' => 'publish' // Only published products
));
// Get all categories
<?php
// Add this code to your theme's functions.php file or use the Code Snippets plugin.
/**
* Recent Blog Posts Shortcode with Title
*/
function custom_recent_blog_posts_shortcode($atts) {
// Extract attributes
$atts = shortcode_atts(array(
@SitesByYogi
SitesByYogi / product-cats.php
Created December 27, 2024 11:59
Displays project categories in WordPress
<?php
// Add this code to your theme's functions.php file or use the Code Snippets plugin.
/**
* WooCommerce Product Categories Dropdown Shortcode with Title
*/
function custom_woocommerce_category_dropdown_shortcode($atts) {
// Ensure WooCommerce is active
if (!class_exists('WooCommerce')) {
@SitesByYogi
SitesByYogi / product-search.php
Created December 27, 2024 11:58
Display a product search bar on your WordPress
<?php
// Add this code to your theme's functions.php file or use the Code Snippets plugin.
/**
* WooCommerce Product Search Bar Shortcode
*/
function custom_woocommerce_product_search_shortcode($atts) {
// Ensure WooCommerce is active
if (!class_exists('WooCommerce')) {
@SitesByYogi
SitesByYogi / display-blog.php
Last active December 27, 2024 11:56
Shortcode to Display Full Blog Post by Post ID Without Featured Image or Title
<?php
// Shortcode to Display Full Blog Post by Post ID Without Featured Image or Title
function display_full_post_no_image($atts) {
// Shortcode Attributes
$atts = shortcode_atts(array(
'id' => '', // Default: no post ID
), $atts, 'full_post_no_image');
// Validate the Post ID