Skip to content

Instantly share code, notes, and snippets.

@neilgee
neilgee / git.css
Last active May 2, 2021
Git Command Line Reference - Notes, Cheatsheet and reminders on Git set up and commands
View git.css
/*
* Set up your Git configuration
*/
git config --global user.email "you@yourdomain.com"
git config --global user.name "Your Name"
git config --global core.editor "nano"
@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 / less-fields-virtual.php
Last active Apr 28, 2021
WooCommerce Remove Address Fields from checkout based on presence of virtual products in cart
View less-fields-virtual.php
<?php
add_filter( 'woocommerce_checkout_fields' , 'virtual_products_less_fields' );
/**
* WooCommerce Remove Address Fields from checkout based on presence of virtual products in cart
* @link https://www.skyverge.com/blog/checking-woocommerce-cart-contains-product-category/
* @link https://docs.woothemes.com/document/tutorial-customising-checkout-fields-using-actions-and-filters/
* @link https://businessbloomer.com/woocommerce-hide-checkout-billing-fields-if-virtual-product-cart/
*/
@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 / faq.html
Last active Apr 7, 2021
FAQ Page with Show and Hide Questions and Answers
View faq.html
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>Create an FAQ Page with Show and Hide Questions and Answers using jQuery</title>
<!-- jQuery -->
<script type="text/javascript" src="//code.jquery.com/jquery-3.6.0.min.js"></script>
<script>
@neilgee
neilgee / carouse-nav-indicators.php
Last active Mar 31, 2021
Bootstrap carousel ACF Repeaters
View carouse-nav-indicators.php
<?php
// *Repeater
// carousel_repeater
// *Sub-Fields
// carousel_image
// carousel_text
// check if the repeater field has rows of data
if( have_rows('carousel_repeater') ):
@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 / socialmenu.html
Last active Mar 28, 2021
FontAwesome Social Media Menu
View socialmenu.html
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css" rel="stylesheet">
<style>
.social-menu {
display: flex;
list-style-type: none;
}
.social-menu i {
color: #fff;
@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>
View get-shorty.php
<?php // <~ don't add me in
add_filter( 'woocommerce_short_description', 'prefix_filter_woocommerce_short_description' );
/**
* Limit WooCommerce Short Description Field
*/
function prefix_filter_woocommerce_short_description( $post_post_excerpt ) {
// make filter magic happen here...
if(! is_product() ) { // add in conditionals
$text = $post_post_excerpt;