Skip to content

Instantly share code, notes, and snippets.

View joshmoto's full-sized avatar

J O S H M O T O joshmoto

View GitHub Profile
@polevaultweb
polevaultweb / acf_pro_license_constant.php
Last active March 22, 2023 03:06
Define the Advanced Custom Fields Pro license key with a constant
<?php
function my_filter_acf_pro_license_option( $pre ) {
if ( ! defined( 'ACF_PRO_LICENSE' ) || empty( ACF_PRO_LICENSE ) ) {
return $pre;
}
$data = array(
'key' => ACF_PRO_LICENSE,
'url' => home_url(),
@nickdavis
nickdavis / functions.php
Created February 28, 2017 10:29
Add 'no-js' class to <html> tag in WordPress in order to work with Modernizr
<?php
add_filter( 'language_attributes', 'add_no_js_class_to_html_tag', 10, 2 );
/**
* Add 'no-js' class to <html> tag in order to work with Modernizr.
*
* (Modernizr will change class to 'js' if JavaScript is supported).
*
* @since 1.0.0
*
@clifgriffin
clifgriffin / sort_terms_naturally.php
Created August 30, 2013 13:23
Add new orderby parameter to get_terms in WordPress to allow for natural or alphanumeric sort
<?php
add_filter('get_terms', 'sort_terms_naturally', 20, 3);
function sort_terms_naturally ( $terms, $taxonomies, $args ) {
if ( isset($args['orderby']) && $args['orderby'] == 'natural' ) {
$sort_terms = array();
foreach($terms as $term) {
$sort_terms[$term->name] = $term;
}