Skip to content

Instantly share code, notes, and snippets.

@neilgee
neilgee / webhook.php
Last active October 6, 2022 13:53
WooCommerce Webhook Custom Action Hook
<?php
/**
* Plugin Name: Woo Custom Webhook
* Plugin URI: https://wpbeaches.com/send-full-product-details-over-woocommerce-webhook-action-hook/
* Description: Custom WooCommerce Webhook Action
* Author URI: https://github.com/woocommerce/woocommerce/issues/20336#issuecomment-829510702
* Version: 0.1.0
*/
@neilgee
neilgee / simple-newsletter.html
Created August 3, 2021 05:42
Simple HTML Newsletter
<div id="wrapper" dir="ltr"
style="background-color: #f5f5f5; margin: 0; -webkit-text-size-adjust: none !important; padding: 3%; width: 94%;">
<table class="wrapper-table" style="margin: auto; max-width: 900px; width: 100%;" border="0" cellspacing="0"
cellpadding="0">
<tbody>
<tr>
<td id="template_header"
style="background-color: #ffffff; border: 1px solid #e5e5e5; padding: 15px; color: #ffffff; font-family: Arial;"
align="center" valign="middle">
<div id="template_header_logo" style="width: 100%;">
@neilgee
neilgee / bricks-container-click.js
Last active May 20, 2021 22:31
Bricks Container Click
<script>
(function ($) {
$(function () {
clickContainer();
});
@neilgee
neilgee / customizer-new-panel.php
Last active June 12, 2021 02:52
Customizer Add New Panel
<?php
add_action( 'customize_register', 'bt_register_theme_customizer', 20 );
/**
* Add new panel
* Register for the Customizer
* @since 1.0.0
*/
function bt_register_theme_customizer( $wp_customize ) {
@neilgee
neilgee / cloudflare.cnf
Created March 31, 2021 02:20
Cloudflare Conf - Fail2Ban
#
# Author: Mike Rushton
#
# IMPORTANT
#
# Please set jail.local's permission to 640 because it contains your CF API key.
#
# This action depends on curl (and optionally jq).
# Referenced from http://www.normyee.net/blog/2012/02/02/adding-cloudflare-support-to-fail2ban by NORM YEE
#
@neilgee
neilgee / php-mysql-connect.php
Created March 28, 2021 00:24
Connecting PHP to MySQL and output data stored in rows from a table
<?php
//Step1
$db = mysqli_connect('localhost','root','root','database_name')
or die('Error connecting to MySQL server.');
?>
<html>
<head>
</head>
@neilgee
neilgee / scripts-ahoy.php
Last active June 1, 2024 22:13
SwiperJS and ACF Image Gallery Thumbnail Carousel
<?php // <~ don't add me in
add_action( 'wp_enqueue_scripts', 'ls_scripts_styles', 20 );
/**
* SwiperJS Scripts
*/
function ls_scripts_styles() {
wp_enqueue_style( 'swipercssbundle', get_stylesheet_directory_uri() . '/css/swiper-bundle.min.css' , array(), '6.4.11', 'all' );
wp_enqueue_script( 'swiperjsbundle', get_stylesheet_directory_uri() . '/js/swiper-bundle.min.js', array(), '6.4.11', true );
wp_enqueue_script( 'swiperinit', get_stylesheet_directory_uri() . '/js/swiper-bundle-init.js', array( 'swiperjsbundle' ), '1.0.0', true );
@neilgee
neilgee / filter-wc-orders-by-gateway.php
Created January 13, 2021 21:55 — forked from bekarice/filter-wc-orders-by-gateway.php
Filters WooCommerce Orders by Payment Gateway Used
<?php
/**
* Plugin Name: Filter WooCommerce Orders by Payment Method
* Plugin URI: http://skyverge.com/
* Description: Filters WooCommerce orders by the payment method used :)
* Author: SkyVerge
* Author URI: http://www.skyverge.com/
* Version: 1.0.0
* Text Domain: wc-filter-orders-by-payment
*
@neilgee
neilgee / gist:a8b8234ef720f988dae90db57046343a
Last active December 27, 2020 23:34 — forked from webaware/gist:6260468
WooCommerce purchase page add-to-cart with quantity and AJAX, without customising any templates. See blog post for details: http://snippets.webaware.com.au/snippets/woocommerce-add-to-cart-with-quantity-and-ajax/
<?php
/**
* start the customisation
*/
function custom_woo_before_shop_link() {
add_filter('woocommerce_loop_add_to_cart_link', 'custom_woo_loop_add_to_cart_link', 10, 2);
add_action('woocommerce_after_shop_loop', 'custom_woo_after_shop_loop');
}
add_action('woocommerce_before_shop_loop', 'custom_woo_before_shop_link');
@neilgee
neilgee / bm-loop.php
Last active November 15, 2021 17:44
Post loop showing full content in Boostrap Mpdal
<?php //<~ don't add me in
add_shortcode( 'modal_post_loop', 'modal_post_loop' );
/**
* Post Query Showing Loop Content in Modals
* @since 1.0.0
*/
function modal_post_loop() {
ob_start();