Changeset 451505
- Timestamp:
- 10/16/2011 05:03:36 AM (14 years ago)
- Location:
- custom-menu/trunk
- Files:
-
- 16 added
- 2 edited
-
class-custom-menu-admin.php (added)
-
class-custom-menu-install.php (added)
-
class-custom-menu-shortcode.php (added)
-
class-custom-menu.php (added)
-
css (added)
-
css/admin.css (added)
-
css/style.css (added)
-
custom-menu.php (modified) (2 diffs)
-
images (added)
-
images/logo.png (added)
-
js (added)
-
js/admin.js (added)
-
js/script.js (added)
-
languages (added)
-
languages/custom-menu.pot (added)
-
readme.txt (modified) (3 diffs)
-
rename (added)
-
uninstall.php (added)
Legend:
- Unmodified
- Added
- Removed
-
custom-menu/trunk/custom-menu.php
r428870 r451505 2 2 /* 3 3 Plugin Name: Custom Menu 4 Plugin URI: http://www.evolonix.com/wordpress/plugins/custom-menu /4 Plugin URI: http://www.evolonix.com/wordpress/plugins/custom-menu 5 5 Description: This plugin allows you to display a custom menu that you've created in your theme's "Menus" section in a post or page. Use [menu name="Menu Name"] in your post or page to insert the custom menu. The "name" attribute is required. Since version 1.2, you can now provide a "title" attribute to add a header title to your custom menu (e.g. [menu name="Menu Name" title="My Menu"].) 6 Version: 1. 26 Version: 1.3 7 7 Author: Evolonix 8 8 Author URI: http://www.evolonix.com 9 9 License: GPL2 10 Text Domain: custom-menu 10 11 */ 11 12 ?> … … 29 30 <?php 30 31 31 if ( ! function_exists( 'get_custom_menu' ) ) : 32 // Install 33 // NOTE: References shortcode. 34 require_once(plugin_dir_path(__FILE__) . 'class-custom-menu-install.php'); 35 register_activation_hook(__FILE__, array('Custom_Menu_Install', 'activate')); 36 register_deactivation_hook(__FILE__, array('Custom_Menu_Install', 'deactivate')); 32 37 33 function get_custom_menu($atts) { 34 if ( !isset( $atts['name'] ) ) 35 return; 36 37 // Get menu 38 $nav_menu = wp_get_nav_menu_object( $atts['name'] ); 38 // I18n 39 add_action('init', function() { load_plugin_textdomain('custom-menu', false, basename(dirname(__FILE__)) . '/languages'); }); 39 40 40 if ( !$nav_menu ) 41 return; 42 43 if ( !empty($atts['title']) ) 44 echo '<h3 class="custom-menu-title">' . $atts['title'] . '</h3>'; 45 46 wp_nav_menu( array( 'fallback_cb' => '', 'menu' => $nav_menu ) ); 47 } 41 // Admin 42 require_once(plugin_dir_path(__FILE__) . 'class-custom-menu-admin.php'); 43 $custom_menu_admin = new Custom_Menu_Admin(); 44 add_action('admin_init', array(&$custom_menu_admin, 'init')); 45 add_action('wp_before_admin_bar_render', array(&$custom_menu_admin, 'before_admin_bar_render')); // (optional) 48 46 49 endif; //get_custom_menu 47 // Front-end (optional) 48 require_once(plugin_dir_path(__FILE__) . 'class-custom-menu.php'); 49 $custom_menu = new Custom_Menu(); 50 add_action('plugins_loaded', array(&$custom_menu, 'init')); 50 51 51 add_shortcode( 'menu', 'get_custom_menu' ); 52 // Shortcode (optional) 53 require_once(plugin_dir_path(__FILE__) . 'class-custom-menu-shortcode.php'); 54 $custom_menu_shortcode = new Custom_Menu_Shortcode(); 55 add_shortcode('menu', array(&$custom_menu_shortcode, 'content')); 52 56 53 57 ?> -
custom-menu/trunk/readme.txt
r428870 r451505 16 16 17 17 1. Upload `custom-menu` to the `/wp-content/plugins/` directory 18 2. Activate the plugin through the 'Plugins' menu in WordPress19 3. Place `[menu name="Menu Name"]` in your posts or pages wherever you want the menu to display.20 4. Optionally, provide a "title" attribute to add a header title to the custom menu.18 1. Activate the plugin through the 'Plugins' menu in WordPress 19 1. Place `[menu name="Menu Name"]` in your posts or pages wherever you want the menu to display. 20 1. Optionally, provide a "title" attribute to add a header title to the custom menu. 21 21 22 22 == Frequently Asked Questions == 23 23 24 24 25 … … 26 27 27 28 29 28 30 == Changelog == 29 31 30 = 1.1 = 31 * Changed the plugin to use the name="Menu Name" attribute instead of just specifying the name in the brackets. 32 = 1.3 = 33 * Added references to the author's website. 34 * Changed the code to be object-oriented. 32 35 33 36 = 1.2 = … … 36 39 * You can now provide a "title" attribute to add a header title to your custom menu (e.g. [menu name="Menu Name" title="My Menu"].) 37 40 41 = 1.1 = 42 * Changed the plugin to use the name="Menu Name" attribute instead of just specifying the name in the brackets. 43 38 44 == Upgrade Notice == 45 46 = 1.3 = 47 No new functionality in this version. 48 49 = 1.2 = 50 You should upgrade to version 1.2 so that you can use the "title" attribute and to have it better find and display your menus. 39 51 40 52 = 1.1 = 41 53 You should upgrade from 1.0 so that it is easier to understand what menu name you are specifying. Before, where you would have specified [menu Menu Name] you now write it like [menu name="Menu Name"]. Much more cleaner and easier to read. 42 54 43 = 1.2 =44 You should upgrade to version 1.2 so that you can use the "title" attribute and to have it better find and display your menus.45 46 55 == Arbitrary section == 47 56
Note: See TracChangeset
for help on using the changeset viewer.