Developer Knowledge Level

This content is intended for WordPress developers, and it may require coding knowledge of WordPress, PHP, and JavaScript. Code examples provided here may contain errors or needs some additional coding. Make sure to test the code before using it on a live website!

If you need fine control over the visibility, the plugin has an option for setting the visibility hook that can be used for custom coding the function to determine visibility on other criteria.

apply_filters( d4p_bbw_{$widget}_visible_{$hook}, $visible, $widget );
Is the widget result visible or not.
The whole widget object
Boolean Filtered Visibility value

Each widget has a Global tab, and on this tab, it has Visibility Hook option (as displayed in the image on the right). If you set hook value, it will be used to create a new filter, and this filter will be used to determine if the widget should be visible or not (on the frontend).

As you can see in the Filter definition, there are two custom elements in the filter name: {$widget} and {$hook}. Widget element depends on the widget, and Hook element is added in the Visibility Hook field.

This filter format is: d4p_bbw_{$widget}_visible_{$hook}. Each plugin widget has an own name to be used in the filter instead of the {$widget} value.

  • New Posts: newposts
  • Online Users: onlineusers
  • Topics Views: topicsviews
  • User Profile: userprofile
  • Usesr Thanks: usersthanks
  • Statistics: statistics
  • Topic Info: topicinfo
  • Forum Info: foruminfo
  • Search: search

If you add Topics Views widget, and set Visibility Hook to ‘my_widget_hook‘, this filter will be: d4p_bbw_topicsviews_visibile_my_widget_hook.

Rate this reference

You are not allowed to rate this post.

Leave a Comment