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
112       * The hook allows a specific sidebar template file to be used in place of the
113       * default sidebar template file. If your file is called sidebar-new.php,
114       * you would specify the filename in the hook as get_sidebar( 'new' ).
115       *
116       * @since 2.2.0
117       * @since 2.8.0 $name parameter added.
118       *
119       * @param string $name Name of the specific sidebar file to use.
120       */
121      do_action( 'get_sidebar', $name );
122
123      $templates = array();
124      $name = (string) $name;
125      if ( '' !== $name )
126           $templates[] = "sidebar-{$name}.php";
127
128      $templates[] = 'sidebar.php';
129
130      // Backward compat code will be removed in a future release