Plugin Directory

Changeset 1166402


Ignore:
Timestamp:
05/23/2015 08:01:44 PM (11 years ago)
Author:
elgreatly
Message:

show hide metabox with javascript

Location:
magic-meta-box/trunk
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • magic-meta-box/trunk/includes/repeater-fields.php

    r1151081 r1166402  
    1515        $field_id =  $id .'[' .$count_repeat . '][' . $opt['id'] .']';
    1616        if(!isset($data[$count_repeat][$opt['id']])) {
    17             $value_field = isset($opt['std']) ? $opt['std'] : '';
     17            $value_field = isset($opt['std'])? $opt['std'] : '';
     18        }
     19        if(!isset($opt['std'])) {
     20            $opt['std'] = '';
    1821        }
    1922        $value_field = isset($data[$count_repeat][$opt['id']])? $data[$count_repeat][$opt['id']] : $opt['std'];
  • magic-meta-box/trunk/js/meta-box-map.js

    r1142770 r1166402  
    11jQuery(document).ready(function($){
    2     //$('.mapMetaboxContainer').closest('tr').css({'display': 'table-column', 'visibility': 'hidden', 'height': 0, 'overflow': 'hidden'});
    3     //$('.mapMetaboxContainer').closest('tr').find('th').css({'vertical-align': 'baseline'});
    42    var marker_position = new google.maps.LatLng(map_dinamic_options.lat, map_dinamic_options.lng);
    53    var map_position = new google.maps.LatLng(map_dinamic_options.lat, map_dinamic_options.lng);
     
    7169                        $(this).addClass('hideTab');
    7270                    }
     71                    $('.tabsMetabox').addClass('showHideOpen');
    7372                });
    7473            });
  • magic-meta-box/trunk/magic-metabox.php

    r1151081 r1166402  
    44Plugin URI: https://wordpress.org/plugins/magic-meta-box/
    55Description: Easy To Create Metabox For Your Theme
    6 Version: 1.2
     6Version: 2.0
    77Author: Abdelrhman ElGreatly
    88License: GPLv2
     
    1515    static $count_metabox = 0;
    1616    static $count_repeat_js = array();
     17    static $show_metabox = array();
    1718    // create meta box based on given data
    1819    public function __construct($id, $opts) {
     
    9596            // Add the color picker css file
    9697            wp_register_script('metabox_js', plugins_url( 'js/metabox.js', __FILE__ ), array('wp-color-picker', 'jquery-ui-datepicker', 'jquery-ui-spinner', 'jquery-ui-slider'));
     98           
     99            wp_register_script('show-hide-metabox', plugins_url( 'js/show-hide-metabox.js', __FILE__ ), array('jquery'));
    97100        }
    98101    }
     
    125128        $options = '';
    126129        $repeat_count_add = 0;
     130        if(isset($this->meta_box['show']) && !empty($this->meta_box['show'])){
     131            foreach ($this->meta_box['show'] as $key => $metaboxShow) {
     132                if($key != 'template' && $key != 'post_format' && $key != 'relation'){
     133                    for($i = 0; $i < count($this->meta_box['show'][$key]); $i++){
     134                        if(is_string($metaboxShow[$i])){
     135                            $term_obj = get_term_by('name', $metaboxShow[$i], $key);
     136                            $this->meta_box['show'][$key][$i] = $term_obj->term_id;
     137                        }
     138                    }
     139                }
     140            }
     141            if(!isset($this->meta_box['show']['relation']) || empty($this->meta_box['show']['relation'])){
     142                $this->meta_box['show']['relation'] = 'or';
     143            }
     144            self::$show_metabox[$this->id] = $this->meta_box['show'];
     145            $show_metabox = array(
     146                'show' => self::$show_metabox,
     147            );
     148            wp_localize_script('show-hide-metabox', 'gs_show_hide', $show_metabox);
     149            wp_enqueue_script('show-hide-metabox');
     150        }
    127151        foreach ($this->meta_box['fields'] as $field) {
    128152            extract($field);
  • magic-meta-box/trunk/readme.txt

    r1151081 r1166402  
    44Requires at least: 4.0
    55Tested up to: 4.1.3
    6 Stable tag: 1.2
     6Stable tag: 2.0
    77License: GPLv2
    88
     
    1414### Features:-
    1515* Easy to use
    16 * support a lot of fields
     16* Support a lot of fields
    1717* Has hooks to add custom field types
    18 * placeholder for inputs
    19 * support repeated single fields
    20 * support repeated group of fields
    21 * repeat editor field
    22 * support tabs to make your custom fields user friendly
     18* Placeholder for inputs
     19* Support repeated single fields
     20* Support repeated group of fields
     21* Repeat editor field
     22* Show/Hide meta box with (javascript)
     23* Support tabs to make your custom fields user friendly
    2324* Cross browsing
    24 * shortcode for Google map to make map field user friendly
    25 * easily integrate with your theme
     25* Shortcode for Google map to make map field user friendly
     26* Easily integrate with your theme
    2627### Documentation
    2728* [Documentation PDF](http://www.mediafire.com/view/6f5wcf690q7gunq/Magic_Meta_Box_Documentation.pdf)
     
    4748* add attribute to change default first option in select type
    4849* add password field type
     50
     51### 2.0
     52
     53* Show/Hide meta box with (javascript)
     54* Fix some bugs
Note: See TracChangeset for help on using the changeset viewer.