Plugin Directory

Changeset 1251026


Ignore:
Timestamp:
09/22/2015 09:23:47 AM (11 years ago)
Author:
cdecou
Message:

0.2.5 version

Location:
custom-field-menu/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • custom-field-menu/trunk/classes/admin/PluginAdminPage.php

    r1250429 r1251026  
    1515        register_setting('cfm_settings', 'title_box');
    1616        register_setting('cfm_settings', 'text_button');
     17        register_setting('cfm_settings', 'force_using_walker');
    1718    }
    1819
     
    3233            <form method="post" action="options.php">
    3334                <?php settings_fields('cfm_settings'); ?>
     35                <div class="postbox">
     36                    <h3><?php echo __('General'); ?></h3>
     37                    <div class="inside">
     38                        <table width="100%" class="form-table cmb_metabox">
     39                            <tr>
     40                                <th width="50%">
     41                                    <label for="force_using_walker"><?php echo __('Force the use of the custom Walker') ?></label>
     42                                </th>
     43                                <td>
     44                                    <input type="checkbox" name="force_using_walker" id="force_using_walker" <?php if(get_option('force_using_walker') == 1){ echo 'checked'; } ?> value="1">
     45                                </td>
     46                            </tr>   
     47                        </table>
     48                    </div>
     49                </div>
    3450                <div class="postbox">
    3551                    <h3><?php echo __('Image field'); ?></h3>
     
    5167                                    <input type="text" name="text_button" id="text_button" value="<?php echo esc_html(get_option('text_button')) ?>">
    5268                                </td>
    53                             </tr>                          
     69                            </tr>                   
    5470                        </table>
    5571                    </div>
  • custom-field-menu/trunk/custom-field-menu.php

    r1250425 r1251026  
    44Plugin URL: http://clement-decou.olympe.in
    55Description: Add custom fields to menu items
    6 Version: 0.2
     6Version: 0.2.5
    77Author: Clément Décou
    88Author URI: http://clement-decou.olympe.in
     
    2929        // add custom menu fields to menu
    3030        add_filter( 'wp_setup_nav_menu_item', array( $this, 'cfm_add_custom_nav_fields' ) );
     31
     32        //Edit the walker if force
     33        add_filter( 'wp_nav_menu_args', array($this, 'cfm_modify_nav_menu_args' ));
    3134
    3235        // save menu custom fields
     
    5659    }
    5760
     61    /**
     62     * Edit the args of wp_nav_menu
     63     *
     64     * @access      public
     65     * @since       0.2.5
     66     * @return      void
     67    */
     68    function cfm_modify_nav_menu_args( $args ){
     69        if(get_option('force_using_walker') == 1){
     70            $args['walker'] = new cfm_walker;
     71        }
     72        return $args;
     73    }
     74
    5875
    5976    /**
     
    6986            wp_enqueue_media();
    7087            wp_register_script('cfm-admin-js', WP_PLUGIN_URL.'/custom-field-menu/js/cfm_script.js', array('jquery'));
    71             wp_localize_script('cfm-admin-js', 'titleBox', get_option('title_box') );
    72             wp_localize_script('cfm-admin-js', 'textButton', get_option('text_button') );
     88            $titleBox = (get_option('title_box') != '') ? get_option('title_box') : 'Choose an image';
     89            $txtButton = (get_option('text_button') != '') ? get_option('text_button') : 'Choose';
     90            wp_localize_script('cfm-admin-js', 'titleBox', $titleBox );
     91            wp_localize_script('cfm-admin-js', 'textButton', $txtButton );
    7392            wp_enqueue_script('cfm-admin-js');
    7493        }
  • custom-field-menu/trunk/custom_walker.php

    r1247335 r1251026  
    1313{
    1414     
    15 
    1615      public function start_lvl( &$output, $depth = 0, $args = array() ) {
    1716          global $_CURRENT_URL_SUBMENU;
  • custom-field-menu/trunk/readme.txt

    r1250427 r1251026  
    33Tags: custom field, CMS, menu, types, field, item, item-menu, custom
    44Requires at least: 3.5
    5 Stable tag: 0.2
     5Stable tag: 0.2.5
    66Tested up to: 4.3
    77License: GPLv2
     
    2323
    2424== Changelog ==
     25
     26= 0.2.5 =
     27* Add - You can force the use of the Walker
     28* Fix - Empty button when switch 0.1.1 to 0.2 and superior version.
     29* Fix - Using on and not live
    2530
    2631= 0.2 =
     
    45502. Activate the plugin
    46513. See the new field in the menu item in Appareance -> Menu
     524. Use cfm_walker walker in your wp_nav function or force-it in the plugin menu.
    4753
    48 That's it!
     54That's it !
    4955
    5056== Frequently Asked Questions ==
Note: See TracChangeset for help on using the changeset viewer.