Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: get_sidebar

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

Line Code
106       * The hook allows a specific sidebar template file to be used in place of the
107       * default sidebar template file. If your file is called sidebar-new.php,
108       * you would specify the filename in the hook as get_sidebar( 'new' ).
109       *
110       * @since 2.2.0
111       * @since 2.8.0 $name parameter added.
112       *
113       * @param string $name Name of the specific sidebar file to use.
114       */
115      do_action( 'get_sidebar', $name );
116
117      $templates = array();
118      $name = (string) $name;
119      if ( '' !== $name )
120           $templates[] = "sidebar-{$name}.php";
121
122      $templates[] = 'sidebar.php';
123
124      // Backward compat code will be removed in a future release