Changeset 1259503
- Timestamp:
- 10/04/2015 11:33:02 PM (10 years ago)
- Location:
- page-specific-menu-items
- Files:
-
- 6 edited
- 2 copied
-
tags/1.6.1 (copied) (copied from page-specific-menu-items/trunk)
-
tags/1.6.1/page-specific-menu-items.php (modified) (7 diffs)
-
tags/1.6.1/readme.txt (modified) (2 diffs)
-
tags/1.6.1/trunk (copied) (copied from page-specific-menu-items/trunk)
-
tags/1.6.1/trunk/page-specific-menu-items.php (modified) (7 diffs)
-
tags/1.6.1/trunk/readme.txt (modified) (4 diffs)
-
trunk/page-specific-menu-items.php (modified) (7 diffs)
-
trunk/readme.txt (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
page-specific-menu-items/tags/1.6.1/page-specific-menu-items.php
r1140937 r1259503 1 1 <?php 2 /* *3 *Plugin Name: Page Specific Menu Items4 *Plugin URI: http://www.wordpress.org/plugins5 *Description: This plugin allows you to select menu items page wise.6 * Version: 1.6 7 *Author: Dharma Poudel (@rogercomred)8 *Author URI: https://www.twitter.com/rogercomred9 *Text Domain: page-specific-menu-items10 *Domain Path: /l10n11 */2 /* 3 Plugin Name: Page Specific Menu Items 4 Plugin URI: http://www.wordpress.org/plugins 5 Description: This plugin allows you to select menu items page wise. 6 Version: 1.6.1 7 Author: Dharma Poudel (@rogercomred) 8 Author URI: https://www.twitter.com/rogercomred 9 Text Domain: page-specific-menu-items 10 Domain Path: /l10n 11 */ 12 12 13 13 //define some constants … … 81 81 82 82 83 /** 84 * get the default values 85 **/ 86 public function get_psmi_defaults() { 87 88 $this->psmi_defaults = get_option( 'psmi_defaults' ) 89 ? get_option( 'psmi_defaults' ) 90 : array('post_type'=>array('page'),'menu_id'=>$menu_id, 'items_defaultview' =>'show'); 91 92 //now persist the default options on database 93 update_option('psmi_defaults', $this->psmi_defaults); 94 return $this->psmi_defaults; 95 } 83 96 84 97 … … 97 110 } 98 111 99 $this->psmi_defaults = get_option( 'psmi_defaults' ) 100 ? get_option( 'psmi_defaults' ) 101 : array('post_type'=>array('page'),'menu_id'=>$menu_id); 112 $this->get_psmi_defaults(); 102 113 103 114 if(function_exists('load_plugin_textdomain')) { … … 180 191 'psmi-setting-admin', // Page 181 192 'psmi-settings' // Section 182 ); 193 ); 194 195 add_settings_field( 196 'psmi-items-viewoptions', // ID 197 __('Items default visibility', PSMI_TEXTDOMAIN), // Title 198 array( $this, 'psmi_items_viewoption_cb' ), // Callback 199 'psmi-setting-admin', // Page 200 'psmi-settings' // Section 201 ); 183 202 } 184 203 … … 228 247 echo __('Unfortunately no menus are available. Create one?', PSMI_TEXTDOMAIN); 229 248 } 249 } 250 251 /** 252 * Prints the menu select box 253 **/ 254 public function psmi_items_viewoption_cb() { 255 256 echo "<select style='min-width:120px;' id='psmi_items_viewoptions' name='psmi_defaults[items_defaultview]' >"; 257 $selected = ('' == $this->psmi_defaults['items_defaultview'])? 'selected="selected"' : '' ; 258 $hide = ('hide' == $this->psmi_defaults['items_defaultview'])? 'selected="selected"' : '' ; 259 $show = ('show' == $this->psmi_defaults['items_defaultview'])? 'selected="selected"' : '' ; 260 printf('<option value="show" %s >show all</option>', $show); 261 printf('<option value="hide" %s >hide all</option>', $hide); 262 echo "</select>"; 230 263 } 231 264 … … 263 296 echo "<p><strong>".__('Current Menu: ', PSMI_TEXTDOMAIN).$menu_object->name."</strong></p>"; 264 297 if ($menu_items) { 265 266 _e("<p>Select menu items to hidein this page. Top level menu items are marked bold.</p>", PSMI_TEXTDOMAIN);298 $items_viewoption = ('show' == $this->psmi_defaults['items_defaultview']) ? 'hide' : 'show'; 299 _e("<p>Select menu items to $items_viewoption in this page. Top level menu items are marked bold.</p>", PSMI_TEXTDOMAIN); 267 300 268 301 echo "<div class='bpwpc_select_row'>"; … … 334 367 $currentpage_items = get_post_meta(get_queried_object_id(), PSMI_TEXTDOMAIN.'_currentpage_items', true); 335 368 336 if (!empty($currentpage_items) && $currentpage_items[0] !=''){ 337 foreach ( $items as $item ) { 338 if ( in_array( $item->ID, $currentpage_items ) ) { 339 $item->classes[] = 'hide_this_item '; 340 } 341 } 342 } 369 $psmi = Page_Specific_Menu_Items::get_psmi_defaults(); 370 371 foreach ( $items as $item ) { 372 if ('show'== $psmi['items_defaultview'] && in_array( $item->ID, $currentpage_items ) ) { 373 $item->classes[] = 'hide_this_item '; 374 } 375 if ('hide'== $psmi['items_defaultview'] && !in_array( $item->ID, $currentpage_items ) ) { 376 $item->classes[] = 'hide_this_item '; 377 } 378 } 379 343 380 return $items; 344 345 381 } 346 382 -
page-specific-menu-items/tags/1.6.1/readme.txt
r1140937 r1259503 2 2 Tags: page specific menu items, post specific menu items, menu, menu items, page wise menu, post wise menu, wordpress menu, 3 3 Requires at least: 3.5 4 Tested up to: 4. 25 Stable tag: 1.6 4 Tested up to: 4.3.1 5 Stable tag: 1.6.1 6 6 License: GPLv3 7 7 Contributors: dharmapoudel … … 69 69 == Changelog == 70 70 71 = 1.6.1 (2015-10-4) = 72 * Added option to easily select and deselect menu items 73 * Added option to set visibility of menu items by default 74 * Fixed plugin does not have a valid header issue (Thanks to DesignsCheap) 75 * Compatible with wordPress version 4.3.1 76 71 77 = 1.6 (2015-4-21) = 72 78 * Added option to easily select and deselect menu items -
page-specific-menu-items/tags/1.6.1/trunk/page-specific-menu-items.php
r1140937 r1259503 1 1 <?php 2 /* *3 *Plugin Name: Page Specific Menu Items4 *Plugin URI: http://www.wordpress.org/plugins5 *Description: This plugin allows you to select menu items page wise.6 * Version: 1.6 7 *Author: Dharma Poudel (@rogercomred)8 *Author URI: https://www.twitter.com/rogercomred9 *Text Domain: page-specific-menu-items10 *Domain Path: /l10n11 */2 /* 3 Plugin Name: Page Specific Menu Items 4 Plugin URI: http://www.wordpress.org/plugins 5 Description: This plugin allows you to select menu items page wise. 6 Version: 1.6.1 7 Author: Dharma Poudel (@rogercomred) 8 Author URI: https://www.twitter.com/rogercomred 9 Text Domain: page-specific-menu-items 10 Domain Path: /l10n 11 */ 12 12 13 13 //define some constants … … 81 81 82 82 83 /** 84 * get the default values 85 **/ 86 public function get_psmi_defaults() { 87 88 $this->psmi_defaults = get_option( 'psmi_defaults' ) 89 ? get_option( 'psmi_defaults' ) 90 : array('post_type'=>array('page'),'menu_id'=>$menu_id, 'items_defaultview' =>'show'); 91 92 //now persist the default options on database 93 update_option('psmi_defaults', $this->psmi_defaults); 94 return $this->psmi_defaults; 95 } 83 96 84 97 … … 97 110 } 98 111 99 $this->psmi_defaults = get_option( 'psmi_defaults' ) 100 ? get_option( 'psmi_defaults' ) 101 : array('post_type'=>array('page'),'menu_id'=>$menu_id); 112 $this->get_psmi_defaults(); 102 113 103 114 if(function_exists('load_plugin_textdomain')) { … … 180 191 'psmi-setting-admin', // Page 181 192 'psmi-settings' // Section 182 ); 193 ); 194 195 add_settings_field( 196 'psmi-items-viewoptions', // ID 197 __('Items default visibility', PSMI_TEXTDOMAIN), // Title 198 array( $this, 'psmi_items_viewoption_cb' ), // Callback 199 'psmi-setting-admin', // Page 200 'psmi-settings' // Section 201 ); 183 202 } 184 203 … … 228 247 echo __('Unfortunately no menus are available. Create one?', PSMI_TEXTDOMAIN); 229 248 } 249 } 250 251 /** 252 * Prints the menu select box 253 **/ 254 public function psmi_items_viewoption_cb() { 255 256 echo "<select style='min-width:120px;' id='psmi_items_viewoptions' name='psmi_defaults[items_defaultview]' >"; 257 $selected = ('' == $this->psmi_defaults['items_defaultview'])? 'selected="selected"' : '' ; 258 $hide = ('hide' == $this->psmi_defaults['items_defaultview'])? 'selected="selected"' : '' ; 259 $show = ('show' == $this->psmi_defaults['items_defaultview'])? 'selected="selected"' : '' ; 260 printf('<option value="show" %s >show all</option>', $show); 261 printf('<option value="hide" %s >hide all</option>', $hide); 262 echo "</select>"; 230 263 } 231 264 … … 263 296 echo "<p><strong>".__('Current Menu: ', PSMI_TEXTDOMAIN).$menu_object->name."</strong></p>"; 264 297 if ($menu_items) { 265 266 _e("<p>Select menu items to hidein this page. Top level menu items are marked bold.</p>", PSMI_TEXTDOMAIN);298 $items_viewoption = ('show' == $this->psmi_defaults['items_defaultview']) ? 'hide' : 'show'; 299 _e("<p>Select menu items to $items_viewoption in this page. Top level menu items are marked bold.</p>", PSMI_TEXTDOMAIN); 267 300 268 301 echo "<div class='bpwpc_select_row'>"; … … 334 367 $currentpage_items = get_post_meta(get_queried_object_id(), PSMI_TEXTDOMAIN.'_currentpage_items', true); 335 368 336 if (!empty($currentpage_items) && $currentpage_items[0] !=''){ 337 foreach ( $items as $item ) { 338 if ( in_array( $item->ID, $currentpage_items ) ) { 339 $item->classes[] = 'hide_this_item '; 340 } 341 } 342 } 369 $psmi = Page_Specific_Menu_Items::get_psmi_defaults(); 370 371 foreach ( $items as $item ) { 372 if ('show'== $psmi['items_defaultview'] && in_array( $item->ID, $currentpage_items ) ) { 373 $item->classes[] = 'hide_this_item '; 374 } 375 if ('hide'== $psmi['items_defaultview'] && !in_array( $item->ID, $currentpage_items ) ) { 376 $item->classes[] = 'hide_this_item '; 377 } 378 } 379 343 380 return $items; 344 345 381 } 346 382 -
page-specific-menu-items/tags/1.6.1/trunk/readme.txt
r1140937 r1259503 2 2 Tags: page specific menu items, post specific menu items, menu, menu items, page wise menu, post wise menu, wordpress menu, 3 3 Requires at least: 3.5 4 Tested up to: 4. 25 Stable tag: 1.6 4 Tested up to: 4.3.1 5 Stable tag: 1.6.1 6 6 License: GPLv3 7 7 Contributors: dharmapoudel … … 13 13 This plugin allows users to select menu items to show per page. One menu different menu items for different pages. 14 14 Also allows users choose which menu to use for cherrypicking menu items page wise. 15 16 Please read the readme.txt file line by line before commenting. If you find any bugs/issues please report and I'll try to fix them asap. 17 Want me to keep updating this plugin with extra features? Rate this plugin. 18 15 19 16 20 **How to make this plugin work?** … … 47 51 * [BlankPress Theme Framework](https://github.com/dharmapoudel/blankpress) - Simple yet flexible HTML5 blank WordPress theme framework based on underscores. Use this as a base theme for your WP projects. 48 52 49 Please read the readme.txt file line by line before commenting. Only after that give me 5 stars. :) If you found any bugs/issues please report and I'll try to fix them asap.50 53 51 54 == Installation == … … 68 71 69 72 == Changelog == 73 74 = 1.6.1 (2015-10-4) = 75 * Added option to easily select and deselect menu items 76 * Added option to set visibility of menu items by default 77 * Fixed plugin does not have a valid header issue (Thanks to DesignsCheap) 78 * Compatible with wordPress version 4.3.1 70 79 71 80 = 1.6 (2015-4-21) = -
page-specific-menu-items/trunk/page-specific-menu-items.php
r1140937 r1259503 1 1 <?php 2 /* *3 *Plugin Name: Page Specific Menu Items4 *Plugin URI: http://www.wordpress.org/plugins5 *Description: This plugin allows you to select menu items page wise.6 * Version: 1.6 7 *Author: Dharma Poudel (@rogercomred)8 *Author URI: https://www.twitter.com/rogercomred9 *Text Domain: page-specific-menu-items10 *Domain Path: /l10n11 */2 /* 3 Plugin Name: Page Specific Menu Items 4 Plugin URI: http://www.wordpress.org/plugins 5 Description: This plugin allows you to select menu items page wise. 6 Version: 1.6.1 7 Author: Dharma Poudel (@rogercomred) 8 Author URI: https://www.twitter.com/rogercomred 9 Text Domain: page-specific-menu-items 10 Domain Path: /l10n 11 */ 12 12 13 13 //define some constants … … 81 81 82 82 83 /** 84 * get the default values 85 **/ 86 public function get_psmi_defaults() { 87 88 $this->psmi_defaults = get_option( 'psmi_defaults' ) 89 ? get_option( 'psmi_defaults' ) 90 : array('post_type'=>array('page'),'menu_id'=>$menu_id, 'items_defaultview' =>'show'); 91 92 //now persist the default options on database 93 update_option('psmi_defaults', $this->psmi_defaults); 94 return $this->psmi_defaults; 95 } 83 96 84 97 … … 97 110 } 98 111 99 $this->psmi_defaults = get_option( 'psmi_defaults' ) 100 ? get_option( 'psmi_defaults' ) 101 : array('post_type'=>array('page'),'menu_id'=>$menu_id); 112 $this->get_psmi_defaults(); 102 113 103 114 if(function_exists('load_plugin_textdomain')) { … … 180 191 'psmi-setting-admin', // Page 181 192 'psmi-settings' // Section 182 ); 193 ); 194 195 add_settings_field( 196 'psmi-items-viewoptions', // ID 197 __('Items default visibility', PSMI_TEXTDOMAIN), // Title 198 array( $this, 'psmi_items_viewoption_cb' ), // Callback 199 'psmi-setting-admin', // Page 200 'psmi-settings' // Section 201 ); 183 202 } 184 203 … … 228 247 echo __('Unfortunately no menus are available. Create one?', PSMI_TEXTDOMAIN); 229 248 } 249 } 250 251 /** 252 * Prints the menu select box 253 **/ 254 public function psmi_items_viewoption_cb() { 255 256 echo "<select style='min-width:120px;' id='psmi_items_viewoptions' name='psmi_defaults[items_defaultview]' >"; 257 $selected = ('' == $this->psmi_defaults['items_defaultview'])? 'selected="selected"' : '' ; 258 $hide = ('hide' == $this->psmi_defaults['items_defaultview'])? 'selected="selected"' : '' ; 259 $show = ('show' == $this->psmi_defaults['items_defaultview'])? 'selected="selected"' : '' ; 260 printf('<option value="show" %s >show all</option>', $show); 261 printf('<option value="hide" %s >hide all</option>', $hide); 262 echo "</select>"; 230 263 } 231 264 … … 263 296 echo "<p><strong>".__('Current Menu: ', PSMI_TEXTDOMAIN).$menu_object->name."</strong></p>"; 264 297 if ($menu_items) { 265 266 _e("<p>Select menu items to hidein this page. Top level menu items are marked bold.</p>", PSMI_TEXTDOMAIN);298 $items_viewoption = ('show' == $this->psmi_defaults['items_defaultview']) ? 'hide' : 'show'; 299 _e("<p>Select menu items to $items_viewoption in this page. Top level menu items are marked bold.</p>", PSMI_TEXTDOMAIN); 267 300 268 301 echo "<div class='bpwpc_select_row'>"; … … 334 367 $currentpage_items = get_post_meta(get_queried_object_id(), PSMI_TEXTDOMAIN.'_currentpage_items', true); 335 368 336 if (!empty($currentpage_items) && $currentpage_items[0] !=''){ 337 foreach ( $items as $item ) { 338 if ( in_array( $item->ID, $currentpage_items ) ) { 339 $item->classes[] = 'hide_this_item '; 340 } 341 } 342 } 369 $psmi = Page_Specific_Menu_Items::get_psmi_defaults(); 370 371 foreach ( $items as $item ) { 372 if ('show'== $psmi['items_defaultview'] && in_array( $item->ID, $currentpage_items ) ) { 373 $item->classes[] = 'hide_this_item '; 374 } 375 if ('hide'== $psmi['items_defaultview'] && !in_array( $item->ID, $currentpage_items ) ) { 376 $item->classes[] = 'hide_this_item '; 377 } 378 } 379 343 380 return $items; 344 345 381 } 346 382 -
page-specific-menu-items/trunk/readme.txt
r1140937 r1259503 2 2 Tags: page specific menu items, post specific menu items, menu, menu items, page wise menu, post wise menu, wordpress menu, 3 3 Requires at least: 3.5 4 Tested up to: 4. 25 Stable tag: 1.6 4 Tested up to: 4.3.1 5 Stable tag: 1.6.1 6 6 License: GPLv3 7 7 Contributors: dharmapoudel … … 13 13 This plugin allows users to select menu items to show per page. One menu different menu items for different pages. 14 14 Also allows users choose which menu to use for cherrypicking menu items page wise. 15 16 Please read the readme.txt file line by line before commenting. If you find any bugs/issues please report and I'll try to fix them asap. 17 Want me to keep updating this plugin with extra features? Rate this plugin. 18 15 19 16 20 **How to make this plugin work?** … … 47 51 * [BlankPress Theme Framework](https://github.com/dharmapoudel/blankpress) - Simple yet flexible HTML5 blank WordPress theme framework based on underscores. Use this as a base theme for your WP projects. 48 52 49 Please read the readme.txt file line by line before commenting. Only after that give me 5 stars. :) If you found any bugs/issues please report and I'll try to fix them asap.50 53 51 54 == Installation == … … 68 71 69 72 == Changelog == 73 74 = 1.6.1 (2015-10-4) = 75 * Added option to easily select and deselect menu items 76 * Added option to set visibility of menu items by default 77 * Fixed plugin does not have a valid header issue (Thanks to DesignsCheap) 78 * Compatible with wordPress version 4.3.1 70 79 71 80 = 1.6 (2015-4-21) =
Note: See TracChangeset
for help on using the changeset viewer.