- Installed Custom Post Type UI wordpress plugin
- Created a custom post type = 'products'
- Registered a custom taxonomy categories (different from category) using
1. How to display all custom post types and have a filter above with categories that works as filter tabs?
2.How to loop in a custom template through the custom taxonomy 'categories' and display links?
HTML structure
Custom Post type URL : /wp-admin/edit-tags.php?taxonomy=categories&post_type=products
PHP
<?php get_term( $term, $taxonomy, $output, $filter ) ?>
<?php
$args=array(
'name' => 'categories'
);
$output = 'products'; // or names
$taxonomies=get_taxonomies($args,$output);
if ($taxonomies) {
foreach ($taxonomies as $taxonomy ) {
echo '<p>' . $taxonomy->name . '</p>';
}
}
?>
<?php
$args = array(
'public' => true,
'_builtin' => false
);
$output = 'names'; // or objects
$operator = 'and'; // 'and' or 'or'
$taxonomies = get_taxonomies( $args, $output, $operator );
if ( $taxonomies ) {
foreach ( $taxonomies as $taxonomy ) {
echo '<p>' . $taxonomy . '</p>';
}
}