Hi,
Sorry for my messages but there is a problem with the function that you provide.
This is my code now. Do you recognize my error?
// using get_the_terms()
$categories = get_the_terms( get_the_ID(), 'aiovg_categories' );
// $popular_terms will be ordered alphabetically, so let's order by count
$categories = usort( $categories, function( $a, $b ){
if ( $a->count < $b->count ) {
return 1;
}
if ( $a->count > $b->count ) {
return -1;
}
return 0;
} );
// we only need slugs, so...
$categories = wp_list_pluck( $categories, 'names' );
if ( ! empty( $categories ) ) {
$meta = array();
foreach ( $categories as $category ) {
$category_url = aiovg_get_category_page_url( $category );
$meta[] = sprintf( '<a href="%s" class="aiovg-link-category">%s</a>', esc_url( $category_url ), esc_html( $category->name ) );
}
printf( '<div class="aiovg-category"><span class="aiovg-icon-folder-open"></span> %s</div>', implode( ', ', $meta ) );
}
I got these errors:
1. Warning: Invalid argument supplied for foreach() in /home/media/public_html/materials/wp-includes/class-wp-list-util.php on line 148
2.
Warning: Invalid argument supplied for foreach() in /home/media/public_html/materials/wp-content/plugins/all-in-one-video-gallery-premium/public/templates/video-thumbnail.php on line 78