Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter JakenCD

    (@vansite)

    This is the solution I think I need.

    so, in “your widget title” –> Do I have to put “Info Canada”? Info canada is the name of the menu I want to put in the left sidebar only for the posts with the category Canada

    1 function custom_rw_display_widget ($display, $instance) {
    2 if (is_category(1) && $instance[‘title’] == ‘Your widget title’) { // change Your widget title
    3 $display = true; // or false if you want to hide it
    4 }
    5 return $display;
    6 }
    7 add_filter(‘rw_display_widget’, ‘custom_rw_display_widget’, 10, 2);

    Plugin Author dFactory

    (@dfactory)

    That’s the right direction.

    ‘Your widget title’ is the title of the widget, no matter what kind of widget it is.

    is_category(1) – 1, is the number of category, so you have to find the ID of Canada category and use it in the code snippet above

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘not displaying widget by category’ is closed to new replies.