I was able to add a extra custom field, named sticky
, to a custom taxonomy, using the wp taxonomy meta plugin, like this:
function YOUR_PREFIX_register_taxonomy_meta_boxes()
{
// Make sure there's no errors when the plugin is deactivated or during upgrade
if ( !class_exists( 'RW_Taxonomy_Meta' ) )
return;
$meta_sections = array();
// First meta section
$meta_sections[] = array(
'title' => 'Sticky', // section title
'taxonomies' => array('tvr_amenity'), // list of taxonomies. Default is array('category', 'post_tag'). Optional
'id' => 'sticky', // ID of each section, will be the option name
'fields' => array( // List of meta fields
array(
'name' => 'Show in home filters',
'id' => 'sticky',
'type' => 'checkbox',
),
),
);
foreach ( $meta_sections as $meta_section )
{
new RW_Taxonomy_Meta( $meta_section );
}
}
Now I’m trying to get all the taxonomies that has this value checked, like this:
$types = $types = get_terms( 'tvr_amenity', array(
'parent' => '0',
'hide_empty' => 1,
'sticky' => 1
) );
But the filter is ignored (all the parent taxonomies are shown), it returns the exact same than:
$types = $types = get_terms( 'tvr_amenity', array(
'parent' => '0',
'hide_empty' => 1
) );
Any idea what I’m missing, here?
OK, got it
first change this:
To get the info in the front end I think this could be the solution: