Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: dynamic_sidebar_has_widgets

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

This hook occurs 2 times in this file.

Line Code
968      }
969
970      $sidebars_widgets = wp_get_sidebars_widgets();
971      if ( empty( $wp_registered_sidebars[ $index ] ) || empty( $sidebars_widgets[ $index ] ) || ! is_array( $sidebars_widgets[ $index ] ) ) {
972           /** This action is documented in wp-includes/widgets.php */
973           do_action( 'dynamic_sidebar_before', $index, false );
974           /** This action is documented in wp-includes/widgets.php */
975           do_action( 'dynamic_sidebar_after',  $index, false );
976           /** This filter is documented in wp-includes/widgets.php */
977           return apply_filters( 'dynamic_sidebar_has_widgets', false, $index );
978      }
979
980      /**
981       * Fires before widgets are rendered in a dynamic sidebar.
982       *
983       * Note: The action also fires for empty sidebars, and on both the front-end
984       * and back-end, including the Inactive Widgets sidebar on the Widgets screen.
985       *
986       * @since 3.9.0
 
Line Code
1103       * and back-end, including the Inactive Widgets sidebar on the Widgets screen.
1104       *
1105       * @since 3.9.0
1106       *
1107       * @param bool       $did_one Whether at least one widget was rendered in the sidebar.
1108       *                            Default false.
1109       * @param int|string $index   Index, name, or ID of the dynamic sidebar.
1110       */
1111
1112      $did_one = apply_filters( 'dynamic_sidebar_has_widgets', $did_one, $index );
1113
1114      return $did_one;
1115 }
1116
1117 /**
1118  * Whether widget is displayed on the front-end.
1119  *
1120  * Either $callback or $id_base can be used
1121  * $id_base is the first argument when extending WP_Widget class