Skip to content

Instantly share code, notes, and snippets.

View Garconis's full-sized avatar
🐞
Debugging

Jon Fuller Garconis

🐞
Debugging
View GitHub Profile
@woogists
woogists / wc-show-cart-contents-total.php
Last active October 26, 2021 20:29
[Theming Snippets] Show cart contents / total
// Use in conjunction with https://gist.github.com/woogists/c0a86397015b88f4ca722782a724ff6c
<a class="cart-customlocation" href="<?php echo wc_get_cart_url(); ?>" title="<?php _e( 'View your shopping cart' ); ?>"><?php echo sprintf ( _n( '%d item', '%d items', WC()->cart->get_cart_contents_count() ), WC()->cart->get_cart_contents_count() ); ?> - <?php echo WC()->cart->get_cart_total(); ?></a>
@Garconis
Garconis / divi-open-toggle-from-another-page.js
Last active September 14, 2020 16:39
Divi | Open toggle from another page (or same page) based on toggle ID and URL hash
// courtesy: https://bernadot.com/divi-theme-how-to-open-toggled-modules-with-a-url-hashtag/
(function($){
// open Toggle module if URL in address bar has same hash
$(window).load(function(){
var et_hash = window.location.hash;
if(window.location.hash) {
$( '.et_pb_toggle' + et_hash )
.removeClass('et_pb_toggle_close')
.addClass('et_pb_toggle_open')
}
@cliffordp
cliffordp / functions.php
Last active April 6, 2023 15:36
The Events Calendar: Remove the Organizers post type from Events
<?php
/**
* The Events Calendar: Remove the Organizers post type from Events.
*
* Replace instances of ORGANIZER_POST_TYPE with VENUE_POST_TYPE if you
* want to do so for Venues instead.
*
* @link https://theeventscalendar.com/knowledgebase/linked-post-types/
* @link https://gist.github.com/a521d02facbc64ce3891c9341384cc07
@freshyjosh
freshyjosh / divi-alternate-fixed-header-logo.js
Last active November 3, 2017 20:24
Divi | Changes logo for fixed header, and changes fixed header offset (based on Divi Booster code)
jQuery(function($) {
// Don't shrink the header until user scrolls down by this offset in pixels
var offset = 200;
// Fixed header logo
var $alt_logo = '/wp-content/uploads/logo-alt.png';
// Override the addClass to prevent fixed header class from being added before offset reached
var $logo = $('#logo').attr('src');
var addclass = $.fn.addClass;
@bolderelements
bolderelements / hide-shipping-based-on-class.php
Last active July 31, 2019 15:34
Hide Shipping Method When Cart Contains Shipping Class
/**
* Hide a free shipping option (instance #7) when the given shipping class is in the cart
* Code snippets should be added to the functions.php file of your child theme
*
* @return array
*/
function hide_shipping_when_class_is_in_cart( $rates, $package ) {
// shipping class IDs that need the method removed
$shipping_classes = array('bulky-items');
$if_exists = false;
@felthy
felthy / custom-search-acf-wordpress.php
Last active April 19, 2021 15:11 — forked from fiskhandlarn/custom-search-acf-wordpress.php
PHP - Wordpress - Search - wordpress custom search function that encompasses ACF/advanced custom fields and taxonomies and split expression before request. Updated to use wpdb prepare() and esc_like().
<?php
/*
##############################
########### Search ###########
##############################
Included are steps to help make this script easier for other to follow
All you have to do is add custom ACF post types into Step 1 and custom taxonomies into Step 10
[list_searcheable_acf list all the custom fields we want to include in our search query]
@return [array] [list of custom fields]
@Garconis
Garconis / divi-mobile-submenu-toggles.css
Last active April 3, 2023 10:02
Divi | WordPress Theme | Mobile Menu Collapsible Submenus via Toggles | CSS & jQuery Tweaks in action: https://i.gyazo.com/93557e9ef5d4aad260e22c6d5896de3b.mp4
/* -- HEADER -- */
/* remove pointer event from menu module mobile wrapper */
.et_pb_module.et_pb_menu .et_mobile_nav_menu {
pointer-events: none;
}
/* make menu module hamburger icon and menu links interactive again */
.et_pb_module.et_pb_menu .et_mobile_nav_menu .mobile_menu_bar,
.et_pb_module.et_pb_menu .et_mobile_nav_menu .et_mobile_menu li a {
@dianjuar
dianjuar / WooCommerce admin bar and dashboard access.md
Last active April 18, 2018 16:43
With the Woocommerse plugin installed, allow some roles to access to the WordPress Dashboard using a hook.

WooCommerce admin bar and dashboard access

Do you wonder why some users at WooCommerce enabled site have access to the top admin bar and WordPress admin dashboard, but some users don’t?

It is by design: WooCommerce plugin developers decided for us for whom they allow access to WordPress admin dashboard and for whom they prohibit it. But thanks them for the professionalism – it is possible to change that default WooCommerce logic via special filters.

Garagulya, V., (2015) Woocommerce Admin Bar Access

Code used.

@xadapter
xadapter / functions.php
Last active March 14, 2018 19:51
Alter date format in Print Invoice, Packing Slip, Delivery Note & Label Plugin for WooCommerce https://www.xadapter.com/product/print-invoices-packing-list-labels-for-woocommerce/
add_filter('wf_pklist_modify_order_date', 'wf_pklist_change_order_date_format', 10, 3);
function wf_pklist_change_order_date_format($order_date, $order, $action)
{
$modified_order_date = $order_date = date("F jS, Y", strtotime($order_date));
return $modified_order_date;
}
@fiskhandlarn
fiskhandlarn / custom-search-acf-wordpress.php
Last active April 17, 2024 06:52 — forked from jserrao/custom-search-acf-wordpress.php
PHP - Wordpress - Search - wordpress custom search function that encompasses ACF/advanced custom fields and taxonomies and split expression before request. I updated this original script with better documentation and XSS / SQL injection support.
<?php
/*
##############################
########### Search ###########
##############################
Included are steps to help make this script easier for other to follow
All you have to do is add custom ACF post types into Step 1 and custom taxonomies into Step 10
I also updated this work to include XSS and SQL injection projection
[list_searcheable_acf list all the custom fields we want to include in our search query]