Skip to content

Instantly share code, notes, and snippets.

@neilgee
neilgee / addinfunctions.php
Last active January 30, 2023 20:34
Gravity Form Word Count
<?php
/* Gravity Forms Word Count Script */
function els_load_scripts() {
wp_enqueue_script('gravity-forms-word-count', get_stylesheet_directory_uri() . '/js/jquery.gravity_word_count.js', array('jquery'), '0.1', true);
}
add_action('wp_enqueue_scripts', 'els_load_scripts');
/*Then in the form, for fields that need the word count, add the class ‘els-word-count[300].' Change [300] as needed for the maximum words that can be added to that particular field.*/
/*Source http://www.gravityhelp.com/forums/topic/maximum-word-count#post-149331*/
@neilgee
neilgee / change-search-form.php
Last active January 19, 2023 12:13
Add Search Toggle at End of Menu
<?php //<~ don't add me in
add_filter( 'get_search_form', 'wpb_alter_search_form', 20 );
// Modify Search Form
function wpb_alter_search_form( $form ){
return '<form role="search" method="get" id="searchform" action="' . esc_url( home_url( '/' ) ) . '" >
<input type="search" name="s" placeholder="SEARCH..." value/>
</form>';
}
@neilgee
neilgee / accordion-repeater-shortcode.php
Last active January 17, 2023 11:12
Bootstrap Accordion ACF Repeater
<?php //<~ don't add me in - add the code below in functions.php
add_shortcode( 'wpb_bs_accordion_acf', 'wpb_bs_accordion_acf' );
/**
* Bootstrap Accordion Repeater Field
*/
function wpb_bs_accordion_acf() {
ob_start();
@neilgee
neilgee / functions.php
Created September 15, 2018 03:41
Filter CPT by Custom Taxonomy in WP Dashboard
<?php // <~ don't add me in
add_action( 'restrict_manage_posts', 'filter_backend_by_taxonomies' , 99, 2);
/* Filter CPT via Custom Taxonomy */
/* https://generatewp.com/filtering-posts-by-taxonomies-in-the-dashboard/ */
function filter_backend_by_taxonomies( $post_type, $which ) {
// Apply this to a specific CPT
if ( 'light' !== $post_type )
@neilgee
neilgee / pc-menu.js
Last active December 15, 2022 17:56
WooCommerce Accordion Style Expand/Collapse Product Category Menu
jQuery(document).ready(function($) {
/**
* WooCommerce Product Category Accordion jQuery Menu
* @link https://wpbeaches.com/woocommerce-accordion-style-expand-collapse-product-category-menu/
*/
if ($('ul.product-categories').length > 0) {
// Set variables
@neilgee
neilgee / woo-endpoint-custom.php
Last active November 22, 2022 13:34
WooCommerce Endpoint Order and Rename - My Account Page v2.6+
<?php
/*
Plugin Name: WooCustom My Account
Plugin URI: http://wpbeaches.com/
Description: WooCustom - add a custom area in my-account
Author: Neil Gee
Version: 1.0.0
Author URI: http://wpbeaches.com
License: GPL-2.0+
@neilgee
neilgee / display-customizer-text.php
Last active November 21, 2022 12:31
Customizer Text Block
<?php
// Change the footer text in Genesis with a back up if blank
add_filter('genesis_footer_creds_text', 'genesischild_footer_text');
function genesischild_footer_text() {
if( get_theme_mod( 'footer_text_block') != "" ) {
echo get_theme_mod( 'footer_text_block');
}
else{
@neilgee
neilgee / faq.html
Last active November 17, 2022 03:56
FAQ Page with Show and Hide Questions and Answers
<!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 / 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 / acf-js.js
Last active September 5, 2022 13:52
ACF Google Map - Get Directions Link
(function($) {
/*
* new_map
*
* This function will render a Google Map onto the selected jQuery element
*
* @type function
* @date 8/11/2013
* @since 4.3.0