| @@ 22-46 (lines=25) @@ | ||
| 19 | * |
|
| 20 | * @param string $name The name of the specialised header. |
|
| 21 | */ |
|
| 22 | function get_header( $name = null ) { |
|
| 23 | /** |
|
| 24 | * Fires before the header template file is loaded. |
|
| 25 | * |
|
| 26 | * The hook allows a specific header template file to be used in place of the |
|
| 27 | * default header template file. If your file is called header-new.php, |
|
| 28 | * you would specify the filename in the hook as get_header( 'new' ). |
|
| 29 | * |
|
| 30 | * @since 2.1.0 |
|
| 31 | * @since 2.8.0 $name parameter added. |
|
| 32 | * |
|
| 33 | * @param string $name Name of the specific header file to use. |
|
| 34 | */ |
|
| 35 | do_action( 'get_header', $name ); |
|
| 36 | ||
| 37 | $templates = array(); |
|
| 38 | $name = (string) $name; |
|
| 39 | if ( '' !== $name ) { |
|
| 40 | $templates[] = "header-{$name}.php"; |
|
| 41 | } |
|
| 42 | ||
| 43 | $templates[] = 'header.php'; |
|
| 44 | ||
| 45 | locate_template( $templates, true ); |
|
| 46 | } |
|
| 47 | ||
| 48 | /** |
|
| 49 | * Load footer template. |
|
| @@ 61-85 (lines=25) @@ | ||
| 58 | * |
|
| 59 | * @param string $name The name of the specialised footer. |
|
| 60 | */ |
|
| 61 | function get_footer( $name = null ) { |
|
| 62 | /** |
|
| 63 | * Fires before the footer template file is loaded. |
|
| 64 | * |
|
| 65 | * The hook allows a specific footer template file to be used in place of the |
|
| 66 | * default footer template file. If your file is called footer-new.php, |
|
| 67 | * you would specify the filename in the hook as get_footer( 'new' ). |
|
| 68 | * |
|
| 69 | * @since 2.1.0 |
|
| 70 | * @since 2.8.0 $name parameter added. |
|
| 71 | * |
|
| 72 | * @param string $name Name of the specific footer file to use. |
|
| 73 | */ |
|
| 74 | do_action( 'get_footer', $name ); |
|
| 75 | ||
| 76 | $templates = array(); |
|
| 77 | $name = (string) $name; |
|
| 78 | if ( '' !== $name ) { |
|
| 79 | $templates[] = "footer-{$name}.php"; |
|
| 80 | } |
|
| 81 | ||
| 82 | $templates[] = 'footer.php'; |
|
| 83 | ||
| 84 | locate_template( $templates, true ); |
|
| 85 | } |
|
| 86 | ||
| 87 | /** |
|
| 88 | * Load sidebar template. |
|
| @@ 100-123 (lines=24) @@ | ||
| 97 | * |
|
| 98 | * @param string $name The name of the specialised sidebar. |
|
| 99 | */ |
|
| 100 | function get_sidebar( $name = null ) { |
|
| 101 | /** |
|
| 102 | * Fires before the sidebar template file is loaded. |
|
| 103 | * |
|
| 104 | * The hook allows a specific sidebar template file to be used in place of the |
|
| 105 | * default sidebar template file. If your file is called sidebar-new.php, |
|
| 106 | * you would specify the filename in the hook as get_sidebar( 'new' ). |
|
| 107 | * |
|
| 108 | * @since 2.2.0 |
|
| 109 | * @since 2.8.0 $name parameter added. |
|
| 110 | * |
|
| 111 | * @param string $name Name of the specific sidebar file to use. |
|
| 112 | */ |
|
| 113 | do_action( 'get_sidebar', $name ); |
|
| 114 | ||
| 115 | $templates = array(); |
|
| 116 | $name = (string) $name; |
|
| 117 | if ( '' !== $name ) |
|
| 118 | $templates[] = "sidebar-{$name}.php"; |
|
| 119 | ||
| 120 | $templates[] = 'sidebar.php'; |
|
| 121 | ||
| 122 | locate_template( $templates, true ); |
|
| 123 | } |
|
| 124 | ||
| 125 | /** |
|
| 126 | * Load a template part into a template |
|