|
1 | 1 | <?php
|
2 | 2 | add_theme_support( 'post-thumbnails' );
|
3 | 3 | add_action('admin_head', 'php_admin_head');
|
4 |
| - add_action( 'init', 'phpmanual_header_menu' ); |
| 4 | + add_action( 'init', 'register_phptr_menus' ); |
5 | 5 | add_action("admin_menu", "setup_phpmanual_menu");
|
6 | 6 | add_action( 'add_meta_boxes', 'documentation_add_custom_box' );
|
7 | 7 |
|
@@ -33,7 +33,7 @@ function my_custom_post_documentation() {
|
33 | 33 | );
|
34 | 34 | register_post_type( 'documentation', $args );
|
35 | 35 | }
|
36 |
| - |
| 36 | + |
37 | 37 | add_action( 'init', 'my_custom_post_documentation' );
|
38 | 38 |
|
39 | 39 |
|
@@ -94,9 +94,10 @@ function myplugin_inner_custom_box( $post ) {
|
94 | 94 |
|
95 | 95 |
|
96 | 96 |
|
97 |
| - function phpmanual_header_menu() |
| 97 | + function register_phptr_menus() |
98 | 98 | {
|
99 | 99 | register_nav_menu( 'header_menu', 'Header Menu' );
|
| 100 | + register_nav_menu( 'footer_links', 'Footer Links' ); |
100 | 101 | }
|
101 | 102 |
|
102 | 103 | function php_admin_head()
|
@@ -132,6 +133,30 @@ function get_header_menu_items()
|
132 | 133 | ?>
|
133 | 134 | <div class="error-message">"Header Menu" does not contain a navigation menu. Please <a href="<?php echo get_admin_url()?>nav-menus.php">build</a> and <a href="<?php echo get_admin_url()?>customize.php">select</a></div>
|
134 | 135 | <?php
|
| 136 | + } |
| 137 | + |
| 138 | + |
| 139 | + function get_footer_links() |
| 140 | + { |
| 141 | + $locations = get_registered_nav_menus(); |
| 142 | + $menus = wp_get_nav_menus(); |
| 143 | + $menu_locations = get_nav_menu_locations(); |
| 144 | + |
| 145 | + $location_id = 'footer_links'; |
| 146 | + |
| 147 | + if (isset($menu_locations[ $location_id ])) |
| 148 | + { |
| 149 | + foreach ($menus as $menu) |
| 150 | + { |
| 151 | + if ($menu->term_id == $menu_locations[ $location_id ]) |
| 152 | + { |
| 153 | + return wp_get_nav_menu_items($menu); |
| 154 | + } |
| 155 | + } |
| 156 | + } |
| 157 | + ?> |
| 158 | + <div class="error-message">"Footer Links" does not contain a navigation menu. Please <a href="<?php echo get_admin_url()?>nav-menus.php">build</a> and <a href="<?php echo get_admin_url()?>customize.php">select</a></div> |
| 159 | + <?php |
135 | 160 | }
|
136 | 161 |
|
137 | 162 | function phpmanual_settings()
|
|
0 commit comments