I am using taxonomy-images/ WordPress plugin ( href="https://en-gb.wordpress.org/plugins/taxonomy-images/" rel="nofollow
noreferrer">https://en-gb.wordpress.org/plugins/taxonomy-images/)
Target:
I have got a poster taxonomy and I would like to display term name and term image. I
would like to be able to display, retrieve ALL terms in my taxonomy, no matter term name
is empty.
Issue: But if both data are not
entered I can not display the term. I am not managing to correctly make use of
'hide_empty'.
Any help appreciated.
Thanks
/*
Template
Name: gof Poster Home Page */
//
https://en-gb.wordpress.org/plugins/taxonomy-images/
?>
$taxonomy
= 'month-category';
$orderby = 'name';
$order = 'ASC';
$show_count = false;
$pad_counts = false;
$hierarchical =
true;
$hide_empty = false;
$title =
'';
$images = 'image_id';
$args = array(
'taxonomy' = $taxonomy,
'orderby' = $orderby,
'order' =
$order,
'show_count' = $show_count,
'pad_counts' =
$pad_counts,
'hierarchical' = $hierarchical,
'hide_empty' = $hide_empty,
'title_li' =
$title
);
//$terms = get_terms( 'month-category', $args
);
// $terms = apply_filters( 'taxonomy-images-get-terms', 'month-category',
$args);
$terms = apply_filters( 'taxonomy-images-get-terms', '',
$args);
if ( ! empty( $terms ) && ! is_wp_error( $terms ) )
{
$count = count( $terms );
$i = 0;
$term_list = '';
foreach ( $terms as $term
) {
$term_list .=
'';
$i++;
// '' . $term->name . ''
if ( $count !=
$i ) {
$term_list .= ' ';
}
else {
$term_list .= '';
}
}
}
?>
No comments:
Post a Comment