Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- Plugin Name: WP Meta Menu
- Description: Overrides the current page menu with one selected from the custom page meta.
- Version: 1.0
- Author: Thomas Burton Sieverding
- Copyright 2010 Thomas Sieverding (email : Jester831@gmail.com)
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
- function wp_meta_menu( $args ) {
- global $post;
- $menu = get_post_meta($post->ID, 'custom-menu', false);
- if(!empty($menu)) { $args['menu'] = $menu[0]; }
- return $args;
- }
- add_filter('wp_nav_menu_args', 'wp_meta_menu');
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement