Plugin Directory

Changeset 1259503


Ignore:
Timestamp:
10/04/2015 11:33:02 PM (10 years ago)
Author:
dharmapoudel
Message:

tagged version 1.6.1

Location:
page-specific-menu-items
Files:
6 edited
2 copied

Legend:

Unmodified
Added
Removed
  • page-specific-menu-items/tags/1.6.1/page-specific-menu-items.php

    r1140937 r1259503  
    11<?php
    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
    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  */
     2/*
     3Plugin Name: Page Specific Menu Items
     4Plugin URI: http://www.wordpress.org/plugins
     5Description: This plugin allows you to select menu items page wise.
     6Version: 1.6.1
     7Author: Dharma Poudel (@rogercomred)
     8Author URI: https://www.twitter.com/rogercomred
     9Text Domain: page-specific-menu-items
     10Domain Path: /l10n
     11*/
    1212 
    1313//define some constants
     
    8181
    8282
     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        }
    8396       
    8497       
     
    97110            }
    98111           
    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();
    102113
    103114            if(function_exists('load_plugin_textdomain')) {
     
    180191                'psmi-setting-admin', // Page
    181192                '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            ); 
    183202        }
    184203       
     
    228247                echo __('Unfortunately no menus are available. Create one?', PSMI_TEXTDOMAIN);
    229248            }
     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>";
    230263        }
    231264       
     
    263296            echo "<p><strong>".__('Current Menu: ',  PSMI_TEXTDOMAIN).$menu_object->name."</strong></p>";
    264297            if ($menu_items) {
    265            
    266                 _e("<p>Select menu items to hide in 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);
    267300
    268301                echo "<div class='bpwpc_select_row'>";
     
    334367            $currentpage_items = get_post_meta(get_queried_object_id(), PSMI_TEXTDOMAIN.'_currentpage_items', true);
    335368
    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
    343380            return $items;
    344            
    345381        }
    346382       
  • page-specific-menu-items/tags/1.6.1/readme.txt

    r1140937 r1259503  
    22Tags: page specific menu items, post specific menu items, menu, menu items, page wise menu, post wise menu,  wordpress menu,
    33Requires at least: 3.5
    4 Tested up to: 4.2
    5 Stable tag: 1.6
     4Tested up to: 4.3.1
     5Stable tag: 1.6.1
    66License: GPLv3
    77Contributors: dharmapoudel
     
    6969== Changelog ==
    7070
     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
    7177= 1.6 (2015-4-21) =
    7278* 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  
    11<?php
    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
    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  */
     2/*
     3Plugin Name: Page Specific Menu Items
     4Plugin URI: http://www.wordpress.org/plugins
     5Description: This plugin allows you to select menu items page wise.
     6Version: 1.6.1
     7Author: Dharma Poudel (@rogercomred)
     8Author URI: https://www.twitter.com/rogercomred
     9Text Domain: page-specific-menu-items
     10Domain Path: /l10n
     11*/
    1212 
    1313//define some constants
     
    8181
    8282
     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        }
    8396       
    8497       
     
    97110            }
    98111           
    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();
    102113
    103114            if(function_exists('load_plugin_textdomain')) {
     
    180191                'psmi-setting-admin', // Page
    181192                '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            ); 
    183202        }
    184203       
     
    228247                echo __('Unfortunately no menus are available. Create one?', PSMI_TEXTDOMAIN);
    229248            }
     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>";
    230263        }
    231264       
     
    263296            echo "<p><strong>".__('Current Menu: ',  PSMI_TEXTDOMAIN).$menu_object->name."</strong></p>";
    264297            if ($menu_items) {
    265            
    266                 _e("<p>Select menu items to hide in 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);
    267300
    268301                echo "<div class='bpwpc_select_row'>";
     
    334367            $currentpage_items = get_post_meta(get_queried_object_id(), PSMI_TEXTDOMAIN.'_currentpage_items', true);
    335368
    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
    343380            return $items;
    344            
    345381        }
    346382       
  • page-specific-menu-items/tags/1.6.1/trunk/readme.txt

    r1140937 r1259503  
    22Tags: page specific menu items, post specific menu items, menu, menu items, page wise menu, post wise menu,  wordpress menu,
    33Requires at least: 3.5
    4 Tested up to: 4.2
    5 Stable tag: 1.6
     4Tested up to: 4.3.1
     5Stable tag: 1.6.1
    66License: GPLv3
    77Contributors: dharmapoudel
     
    1313This plugin allows users to select menu items to show per page. One menu different menu items for different pages.
    1414Also allows users choose which menu to use for cherrypicking menu items page wise.
     15
     16Please 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.
     17Want me to keep updating this plugin with extra features? Rate this plugin.
     18
    1519
    1620**How to make this plugin work?**
     
    4751* [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.
    4852
    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.
    5053
    5154== Installation ==
     
    6871
    6972== 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
    7079
    7180= 1.6 (2015-4-21) =
  • page-specific-menu-items/trunk/page-specific-menu-items.php

    r1140937 r1259503  
    11<?php
    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
    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  */
     2/*
     3Plugin Name: Page Specific Menu Items
     4Plugin URI: http://www.wordpress.org/plugins
     5Description: This plugin allows you to select menu items page wise.
     6Version: 1.6.1
     7Author: Dharma Poudel (@rogercomred)
     8Author URI: https://www.twitter.com/rogercomred
     9Text Domain: page-specific-menu-items
     10Domain Path: /l10n
     11*/
    1212 
    1313//define some constants
     
    8181
    8282
     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        }
    8396       
    8497       
     
    97110            }
    98111           
    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();
    102113
    103114            if(function_exists('load_plugin_textdomain')) {
     
    180191                'psmi-setting-admin', // Page
    181192                '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            ); 
    183202        }
    184203       
     
    228247                echo __('Unfortunately no menus are available. Create one?', PSMI_TEXTDOMAIN);
    229248            }
     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>";
    230263        }
    231264       
     
    263296            echo "<p><strong>".__('Current Menu: ',  PSMI_TEXTDOMAIN).$menu_object->name."</strong></p>";
    264297            if ($menu_items) {
    265            
    266                 _e("<p>Select menu items to hide in 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);
    267300
    268301                echo "<div class='bpwpc_select_row'>";
     
    334367            $currentpage_items = get_post_meta(get_queried_object_id(), PSMI_TEXTDOMAIN.'_currentpage_items', true);
    335368
    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
    343380            return $items;
    344            
    345381        }
    346382       
  • page-specific-menu-items/trunk/readme.txt

    r1140937 r1259503  
    22Tags: page specific menu items, post specific menu items, menu, menu items, page wise menu, post wise menu,  wordpress menu,
    33Requires at least: 3.5
    4 Tested up to: 4.2
    5 Stable tag: 1.6
     4Tested up to: 4.3.1
     5Stable tag: 1.6.1
    66License: GPLv3
    77Contributors: dharmapoudel
     
    1313This plugin allows users to select menu items to show per page. One menu different menu items for different pages.
    1414Also allows users choose which menu to use for cherrypicking menu items page wise.
     15
     16Please 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.
     17Want me to keep updating this plugin with extra features? Rate this plugin.
     18
    1519
    1620**How to make this plugin work?**
     
    4751* [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.
    4852
    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.
    5053
    5154== Installation ==
     
    6871
    6972== 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
    7079
    7180= 1.6 (2015-4-21) =
Note: See TracChangeset for help on using the changeset viewer.