Skip to content

Instantly share code, notes, and snippets.

@neilgee
neilgee / taxonomy-dropdown-search.php
Last active November 7, 2021 20:27
Custom Taxonomy Dropdown Search
<?php
//http://clicknathan.com/web-design/wordpress-custom-taxonomy-dropdown-without-a-submit-button/
//This goes function.php
class my_Walker_CategoryDropdown extends Walker_CategoryDropdown {
function start_el(&$output, $category, $depth, $args) {
$pad = str_repeat(' ', $depth * 3);
$cat_name = apply_filters('list_cats', $category->name, $category);
$output .= "\t<option class=\"level-$depth\" value=\"".$category->slug."\"";
@neilgee
neilgee / archive-portfolio.php
Last active November 7, 2021 20:21
Isotope Portfolio Filtering in Genesis
<?php
// Force full width content (optional)
add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' );
// Enqueue javascript
wp_enqueue_script('isotope', get_stylesheet_directory_uri() . '/js/isotope.min.js', array('jquery'), '3.0.1', true);
wp_enqueue_script('isotope_init', get_stylesheet_directory_uri() . '/js/isotope-init.js', array('isotope'), '3.0.1', true);
@neilgee
neilgee / isotope-init.js
Last active November 7, 2021 20:19
Isotope Filter Custom Taxonomy on CPT Archive Page
jQuery(document).ready(function($){
var $grid = $('.grid').isotope({
itemSelector: '.grid-item',
percentPosition: true,
layoutMode: 'fitRows',
});
// Layout Isotope after each image loads
$grid.imagesLoaded().progress( function() {
@neilgee
neilgee / jetpackip.txt
Created October 13, 2015 06:51
WhiteList JetPack IP addresses
# Block WordPress xmlrpc.php requests
<Files xmlrpc.php>
order deny,allow
deny from all
allow from 220.239.238.83
allow from 192.0.64.0/18
allow from 209.15.0.0/16
allow from 66.155.0.0/17
allow from 185.64.140.0/22
</Files>
@neilgee
neilgee / scripts-ahoy.php
Last active October 28, 2021 22:28
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 / remove-sort-woo.php
Created May 6, 2015 03:06
Remove WooCommerce Default Sort and Results Amount Notice
<?php // <- dont add in the opening tag
//remove display notice - Showing all x results
remove_action( 'woocommerce_before_shop_loop', 'woocommerce_result_count', 20 );
//remove default sorting drop-down from WooCommerce
remove_action( 'woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 30 );
@neilgee
neilgee / icon-canvas.css
Last active October 23, 2021 23:21
Beaver Builder - Icon Canvas enlarge
.fl-icon-selector .fl-lightbox {
height: 100%;
width: 100%;
margin-top: 0 !important;
}
@neilgee
neilgee / carouse-nav-indicators.php
Last active October 12, 2021 03:09
Bootstrap carousel ACF Repeaters
<?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 / hide-prod-cat-woo.php
Last active October 4, 2021 08:43
Hide WooCommerce Product Categories
<?php //<~ dont add me into functions.php
add_action( 'woocommerce_product_query', 'prefix_custom_pre_get_posts_query' );
/**
* Hide Product Cateories from targetted pages in WooCommerce
* @link https://gist.github.com/stuartduff/bd149e81d80291a16d4d3968e68eb9f8#file-wc-exclude-product-category-from-shop-page-php
*
*/
function prefix_custom_pre_get_posts_query( $q ) {
@neilgee
neilgee / acf-first-row.php
Last active September 17, 2021 18:20
ACF Repeater - Grab First/LAst or Random Single Data Row
<?php
//My ACF Fields for reference
//testimonials - field group
//testimonial - sub-field
//testimonial_header - sub-field
//First Repeater Row in Array
$rows = get_field( 'testimonials', 348 );// grab all rows from page ID