0

I'm using the default category widget to show my category list in sidebar.

The problem is when I select some category to visit the corresponding category page [ex: football], the widget title [which is: My Category] disappears & shows the category title there [in this case: football]. I don't want that.

I want my widget to always show the widget title whether I select a category or not. I don't know if I explained it correctly or not!

1 Answer 1

0

That is not native behavior of it.

If you check the source of WP_Widget_Categories

$title = apply_filters( 'widget_title', empty( $instance['title'] ) ? __( 'Categories' ) : $instance['title'], $instance, $this->id_base );

The title comes exclusively from the value saved in instance (or default if not). There is no logic to tie it in with current context.

Something is changing that behavior, some possibilities that come to mind:

  • you might have something override native widget
  • some code might be using widget_title, possibly incorrectly, to override
  • some JS code on front end might be changing title
3
  • this is the url: imransdesign.com/app/category/chicken can you check. see instead of showing category, it is showing chicken (3), the category title. Commented May 19, 2015 at 19:32
  • That's not actual title of the widget. The widget title seems to be present in source of the page, but not visible. Looks like a problem with theme styling or markup to me.
    – Rarst
    Commented May 19, 2015 at 19:37
  • hummm got it... it was modified, thanks for pointing out! Commented May 19, 2015 at 20:08

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.