Hi everyone ;)
I try to not have a result like "No categories" from the wp_list_categories function. How can we display nothing if there's no categories ?
Anyone have a solution ?
Best regards
Hi everyone ;)
I try to not have a result like "No categories" from the wp_list_categories function. How can we display nothing if there's no categories ?
Anyone have a solution ?
Best regards
Any ideas ?
This code would do it:
<?php
$cats = wp_list_categories('echo=0');
if ( !preg_match( '/No\scategories/i', $cats ) ) { echo $cats; }
?>
If the displayed Text reads "No categories".
Jan
This topic has been closed to new replies.