Skip to content

Instantly share code, notes, and snippets.

@neilgee
neilgee / customizer-new-panel.php
Last active Apr 23, 2021
Customizer Add New Panel
View customizer-new-panel.php
<?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 Mar 31, 2021
Cloudflare Conf - Fail2Ban
View cloudflare.cnf
#
# 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 Mar 28, 2021
Connecting PHP to MySQL and output data stored in rows from a table
View php-mysql-connect.php
<?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 Apr 29, 2021
SwiperJS and ACF Image Gallery Thumbnail Carousel
View scripts-ahoy.php
<?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 Jan 13, 2021 — forked from bekarice/filter-wc-orders-by-gateway.php
Filters WooCommerce Orders by Payment Gateway Used
View filter-wc-orders-by-gateway.php
<?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 Dec 27, 2020 — 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/
View gist:a8b8234ef720f988dae90db57046343a
<?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 Oct 24, 2020
Post loop showing full content in Boostrap Mpdal
View bm-loop.php
<?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();
@neilgee
neilgee / featured-loop.php
Last active Oct 25, 2020
WooCommerce Featured Products - Featured Image Loop
View featured-loop.php
@neilgee
neilgee / wc-image-loop.php
Created Oct 2, 2020
WooCommerce Featured Image Loop
View wc-image-loop.php
<?php //<~ don't add me in
add_shortcode ('woo_featured_image', 'woo_featured_image_loop' );
/**
* Create WooCommerce Featured Image Loop Slider
*/
function woo_featured_image_loop() {
ob_start();
// Setup your custom query
@neilgee
neilgee / tag-gone.php
Created Aug 18, 2020
Remove Product Tags from Products in WooCommerce
View tag-gone.php
<?php //<~ don't add me in
/**
* Remove Product Tags from Products Post Type - WooCommerce
* @link https://rudrastyh.com/woocommerce/remove-product-tags.html
* @author Misha Rudrastyh
*/
add_action( 'admin_menu', 'themeprefix_hide_product_tags_admin_menu', 9999 );
function themeprefix_hide_product_tags_admin_menu() {