Skip to content

Instantly share code, notes, and snippets.

@huytrq
huytrq / functions1a.php
Created August 25, 2023 04:36 — forked from agusmu/functions1a.php
Customize WooCommerce Categories & Tags Label
/* Customize Product Categories Labels */
add_filter( 'woocommerce_taxonomy_args_product_cat', 'custom_wc_taxonomy_args_product_cat' );
function custom_wc_taxonomy_args_product_cat( $args ) {
$args['label'] = __( 'Product Categories', 'woocommerce' );
$args['labels'] = array(
'name' => __( 'Product Categories', 'woocommerce' ),
'singular_name' => __( 'Product Category', 'woocommerce' ),
'menu_name' => _x( 'Categories', 'Admin menu name', 'woocommerce' ),
'search_items' => __( 'Search Product Categories', 'woocommerce' ),
'all_items' => __( 'All Product Categories', 'woocommerce' ),
@huytrq
huytrq / WP_Query.php
Created April 29, 2022 09:23 — forked from Dimasmagadan/WP_Query.php
#WordPress query with args
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.com
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
* Source: https://core.trac.wordpress.org/browser/tags/3.9/src/wp-includes/query.php
*/
$args = array(
//////Author Parameters - Show posts associated with certain author.
@huytrq
huytrq / autoptimize_defer_inline_jquery.php
Created January 31, 2021 14:30 — forked from futtta/autoptimize_defer_inline_jquery.php
POC to defer inline JS that requires jQuery
<?php
add_action('plugins_loaded','ao_defer_inline_init');
function ao_defer_inline_init() {
if ( get_option('autoptimize_js_include_inline') != 'on' ) {
add_filter('autoptimize_html_after_minify','ao_defer_inline_jquery',10,1);
}
}
function ao_defer_inline_jquery( $in ) {
@huytrq
huytrq / element-name.php
Created January 30, 2021 11:40
Visual Composer custom module
<?php
/*
* Element Description: VC Custom Element
*/
// Element Class
class vcCustomElement {
// Element Init
function __construct() {
@huytrq
huytrq / gsap-properties-cheat-sheet.md
Created August 13, 2020 10:28 — forked from lunelson/gsap-properties-cheat-sheet.md
Greensock Properties Cheat Sheet

Greensock CSS properties Cheat Sheet

I wrote this as a reference for myself because some of the property names are non-obvious, and there are a number of relevant special properties, and there is no central concise listing of them all in GSAP Docs, other than (in longer form) on the CSSPlugin page.

Standard CSS properties

...are all supported, with hyphenated-names becoming camelCaseNames. Non-animatable properties are also supported but they will be set at the beginning of the tween.

Special mentions:

@huytrq
huytrq / gallery.php
Created April 2, 2018 10:11 — forked from kokers/gallery.php
ACF Pagination Gallery with categories
@huytrq
huytrq / custom-post-taxonomy-permalinks.php
Created March 26, 2018 10:30 — forked from kasparsd/custom-post-taxonomy-permalinks.php
Create permalink structure URLs for custom post types that include all parent terms from a custom taxonomy
<?php
/*
Term Archive Pages:
- http://example.com/recipes/dinner/
- http://example.com/recipes/breakfast,brunch/
Single Recipe Pages:
- http://example.com/recipes/dinner/soup-title/
@huytrq
huytrq / gist:4887bae53f6e02f2537ab3f023dfa67d
Created January 18, 2018 09:50 — forked from thomasgriffin/gist:5368d5d28da58dd19f73
Prevent Gravity Forms from storing entries on a specific form.
<?php
add_action( 'gform_after_submission_5', 'tgm_io_remove_form_entry' );
/**
* Prevents Gravity Form entries from being stored in the database
* for a specific form. In this case, the form ID is 5. Change 5 in
* the hook to target your specific form ID.
*
* @global object $wpdb The WP database object.
* @param array $entry Array of entry data.
*/