2

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
  • 1
    Questions are meant to be references for later visitors as well. Please rework your questions spelling/punctuation/grammar/capitalization so it as as easy to read as possible. Thanks. Aside from that: Please show your actual code.
    – kaiser
    Commented Nov 14, 2013 at 13:37

1 Answer 1

2

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');
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.