A way to query custom taxonomies by name

You can add a search field to get_terms arguments, which will have wildcards added by WordPress automatically: $args = array( ‘hide_empty’ => false, ‘search’ => $searched_term, ); get_terms(‘hotellocation’, $args); This is documented about mid-way down the page here. There are also other similar arguments you could use, such as name__like, if search doesn’t work for … Read more

Nested loop : wich way/order?

You need to add a tax_query parameter with a relation to do this, $args = array( ‘post_type’ => array(‘my_custom_post’, ‘another_custom_post’), ‘tax_query’ => array( ‘relation’ => ‘AND’, array( ‘taxonomy’ => ‘progression’, ‘field’ => ‘slug’, ‘terms’ => $term->slug, ), array( ‘taxonomy’ => ‘sport’, ‘field’ => ‘term_id’, ‘terms’ => array( 1, 2, 3 ), ‘operator’ => ‘IN’, ), … Read more

Trying to get a PHP variable defined in a custom post into a javascript file. Null value. Using wp_localize_script

Adding JavaScript with wp_enqueue_script: Firstly, although it may work (if you add it before the call of wp_head()), but you should never add wp_enqueue_script CODE in header.php. Use theme’s functions.php file for that. Secondly, the following line in your CODE is problematic: wp_enqueue_script( ‘animated’, get_template_directory_uri() . ‘/js/animated.js’ ); As you’ve used jQuery in your animated.js … Read more