how can I show the categories inline in a widget?? I already tried using the wp function wp_list_categories (‘style = none’) and using the php function str_replace to replace the tags br but without success.
Thanks

1 Answer
1

wp_list_categories ('style = none') will echo its content as it goes. It won’t pass back string that you can replace. You need to use the wp_list_categories filter to strip the <br /> tags.

add_filter(
  'wp_list_categories',
  function($str) {
    return str_replace('<br />','',$str);
  }
);
wp_list_categories('style=none');

Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *