Changeset 1152065
- Timestamp:
- 05/03/2015 05:02:46 AM (11 years ago)
- Location:
- silencesoft-disable-menu-items
- Files:
-
- 7 edited
- 1 copied
-
tags/1.0 (copied) (copied from silencesoft-disable-menu-items/trunk)
-
trunk/lang/sil_disable-en_EN.mo (modified) (previous)
-
trunk/lang/sil_disable-en_EN.po (modified) (2 diffs)
-
trunk/lang/sil_disable-es_ES.mo (modified) (previous)
-
trunk/lang/sil_disable-es_ES.po (modified) (2 diffs)
-
trunk/readme.txt (modified) (3 diffs)
-
trunk/sil-disable-menu-items.php (modified) (6 diffs)
-
trunk/tocka-nav-menu-walker.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
silencesoft-disable-menu-items/trunk/lang/sil_disable-en_EN.po
r693417 r1152065 3 3 "Project-Id-Version: Silencesoft Disable Menu Items 1.0\n" 4 4 "Report-Msgid-Bugs-To: \n" 5 "POT-Creation-Date: 201 3-04-02 11:47-0500\n"6 "PO-Revision-Date: 201 3-04-02 11:47-0500\n"5 "POT-Creation-Date: 2015-05-02 23:04-0500\n" 6 "PO-Revision-Date: 2015-05-02 23:04-0500\n" 7 7 "Last-Translator: Byron H <bh@silencesoft.co>\n" 8 8 "Language-Team: Silencesoft <bh@silencesoft.co>\n" 9 "Language: \n"9 "Language: en_US\n" 10 10 "MIME-Version: 1.0\n" 11 11 "Content-Type: text/plain; charset=UTF-8\n" … … 13 13 "X-Poedit-KeywordsList: _e;__\n" 14 14 "X-Poedit-Basepath: ../\n" 15 "X-Poedit-Language: English\n"16 "X-Poedit-Country: UNITED STATES\n"17 15 "X-Poedit-SourceCharset: utf-8\n" 16 "X-Generator: Poedit 1.7.5\n" 18 17 "X-Poedit-SearchPath-0: .\n" 19 18 20 #: tocka-nav-menu-walker.php:4721 msgid "Disable "19 #: sil-disable-menu-items.php:76 20 msgid "Disable menu item" 22 21 msgstr "" 23 -
silencesoft-disable-menu-items/trunk/lang/sil_disable-es_ES.po
r693417 r1152065 3 3 "Project-Id-Version: Silencesoft Disable Menu Items 1.0\n" 4 4 "Report-Msgid-Bugs-To: \n" 5 "POT-Creation-Date: 201 3-04-02 11:47-0500\n"6 "PO-Revision-Date: 201 3-04-02 11:49-0500\n"5 "POT-Creation-Date: 2015-05-02 23:04-0500\n" 6 "PO-Revision-Date: 2015-05-02 23:04-0500\n" 7 7 "Last-Translator: Byron H <bh@silencesoft.co>\n" 8 8 "Language-Team: Silencesoft <bh@silencesoft.co>\n" 9 "Language: \n"9 "Language: es_ES\n" 10 10 "MIME-Version: 1.0\n" 11 11 "Content-Type: text/plain; charset=UTF-8\n" … … 13 13 "X-Poedit-KeywordsList: _e;__\n" 14 14 "X-Poedit-Basepath: ../\n" 15 "X-Poedit-Language: Spanish\n"16 "X-Poedit-Country: SPAIN\n"17 15 "X-Poedit-SourceCharset: utf-8\n" 16 "X-Generator: Poedit 1.7.5\n" 18 17 "X-Poedit-SearchPath-0: .\n" 19 18 20 #: tocka-nav-menu-walker.php:47 21 msgid "Disable" 22 msgstr "Deshabilitar" 23 19 #: sil-disable-menu-items.php:76 20 msgid "Disable menu item" 21 msgstr "Deshabilitar ítem de menú" -
silencesoft-disable-menu-items/trunk/readme.txt
r693417 r1152065 2 2 by: Byron Herrera - bh at silencesoft dot co 3 3 Contributors: silence 4 Donate link: http://www.silencesoft. co/4 Donate link: http://www.silencesoft.pw/ 5 5 Tags: menu, disable, hide, menu items 6 6 Requires at least: 3.0.1 7 Tested up to: 3.58 Stable tag: 1. 07 Tested up to: 4.1 8 Stable tag: 1.1 9 9 License: WTFPL 10 10 License URI: http://www.wtfpl.net/txt/copying/ … … 29 29 In every menu item will be a new option "Disable", use it. 30 30 31 == FAQ == 32 33 = 1. Is this plugin compatible with another menu Walkers? = 34 35 Wordpress has not a filter to hook custom fields on menus as explained 36 here: 37 https://wordpress.org/plugins/nav-menu-roles/faq/#conflict 38 Version 1.1 of this plugin implements the fix proposed to work with 39 another plugins. 40 31 41 == Screenshots == 32 42 33 1. Mo fifying a menu item43 1. Modifying a menu item 34 44 35 45 == Changelog == … … 38 48 * First release. 39 49 50 = 1.1 = 51 * Added support for action wp_nav_menu_item_custom_fields to fix Walker 52 Conflict. 53 -
silencesoft-disable-menu-items/trunk/sil-disable-menu-items.php
r701914 r1152065 3 3 * Plugin Name: Silencesoft Disable Menu Items 4 4 * Description: Allow to enable/disable menu items 5 * Version: 1. 05 * Version: 1.1 6 6 * Plugin URI: http://silencesoft.co 7 7 * Author: Byron Herrera … … 29 29 **/ 30 30 31 // don't load directly 32 if ( !function_exists( 'is_admin' ) ) { 33 header( 'Status: 403 Forbidden' ); 34 header( 'HTTP/1.1 403 Forbidden' ); 35 exit(); 36 } 37 38 31 39 if ( !class_exists( "Sil_Disable_Items_Plugin" ) ): 32 40 … … 38 46 */ 39 47 function __construct() { 40 add_ action( 'wp_edit_nav_menu_walker', array( $this, 'edit_nav_menu_walker' ));48 add_filter( 'wp_edit_nav_menu_walker', array( $this, 'edit_nav_menu_walker' ),10, 1 ); 41 49 add_action( 'wp_update_nav_menu_item', array( $this, 'sil_disable_update_nav_menu_item' ), 10, 3 ); 42 50 add_filter( 'wp_nav_menu_objects', array( $this, 'sil_nav_menu_items' ) ); 43 51 add_action('plugins_loaded', array( $this, 'sil_plugin_init') ); 52 // fix for Walker 53 add_action( 'wp_nav_menu_item_custom_fields', array( $this, 'sil_custom_fields' ), 10, 4 ); 44 54 } 45 55 … … 62 72 } 63 73 64 74 function sil_custom_fields( $item_id, $item, $depth, $args ) { 75 $test_val = esc_attr( get_post_meta( $item_id, 'sil_disable_menu_item_test_val', TRUE ) ); 76 $test_val = ($test_val == "1")?" checked='checked'":''; 77 print "<div class='field-disable description-wide'><input type='checkbox' ".$test_val." value='1' name='sil_disable_menu_item_test_val_".$item_id."' /><span class='description'>".__('Disable menu item', 'sil_disable')."</span></div>"; 78 } 79 65 80 /** 66 81 * Save post meta. Menu items are just posts of type "menu_item". … … 76 91 update_post_meta( $menu_item_id, 'sil_disable_menu_item_test_val', $_POST[ "sil_disable_menu_item_test_val_$menu_item_id" ] ); 77 92 } else { 78 #mfmfmf("DEL");79 93 delete_post_meta( $menu_item_id, 'sil_disable_menu_item_test_val' ); 80 94 } … … 88 102 $dis = get_post_meta( $item->ID, 'sil_disable_menu_item_test_val' , true); 89 103 if ($dis != "1") 90 $new_items[] = $item;104 $new_items[] = $item; 91 105 92 106 } -
silencesoft-disable-menu-items/trunk/tocka-nav-menu-walker.php
r693417 r1152065 42 42 $test_val = esc_attr( get_post_meta( $menu_item_id, 'sil_disable_menu_item_test_val', TRUE ) ); 43 43 $test_val = ($test_val == "1")?" checked='checked'":''; 44 45 // fix for walker conflict 46 ob_start(); 47 do_action( 'wp_nav_menu_item_custom_fields', $id, $item, $depth, $args ); 48 $fields = ob_get_clean(); 44 49 45 50 // by means of phpQuery magic, inject a new input field 46 51 $_li->find( '.field-link-target' ) 47 ->before( "<p><input type='checkbox' ".$test_val." value='1' name='sil_disable_menu_item_test_val_$menu_item_id' />".__('Disable', 'sil_disable')."</p>" ); 52 ->before($fields); 53 54 // ->before( "<div class='field-disable description-wide'><input type='checkbox' ".$test_val." value='1' name='sil_disable_menu_item_test_val_$menu_item_id' /><span class='description'>".__('Disable menu item', 'sil_disable')."</span></div>" ) 48 55 49 56 // swap the $output
Note: See TracChangeset
for help on using the changeset viewer.