CodeHQ

Posts Tagged ‘Taxonomy’

|

Custom query on taxonomy page | WordPress

Thursday, June 14th, 2018

This will go in taxnonomy.php or taxonomy-name.php templates.

$term = get_term_by( 'slug', get_query_var('term'), get_query_var('taxonomy') ); 

$customField = get_field('custom_field_name')];
$args = array(
	'posts_per_page' => '-1',
	'post_type' 	 => 'service_centres',
	'tax_query' => array (
		array (
			'taxonomy' => 'regions',
			'field' => 'slug',
			'terms' =>  $term->slug
		)
	),
	'meta_key'	 => 'custom_field_name',
	'meta_value'	 => 'custom_field_value_value'
);

Tags: , , , , ,
Posted in PHP, WordPress | No Comments »

Custom fields in custom taxonomy archive page | WordPress

Thursday, December 1st, 2016

$queried_object = get_queried_object(); 
$taxonomy = $queried_object->taxonomy;
$term_id = $queried_object->term_id;
the_field('custom_field_name', $queried_object);

Tags: , , , , , ,
Posted in PHP, WordPress | No Comments »

Display taxonomy term name | WordPress

Thursday, August 18th, 2016

Tags: , , , , , , ,
Posted in PHP, WordPress | No Comments »