Plugin Directory

Changeset 1546419


Ignore:
Timestamp:
12/06/2016 11:38:40 AM (9 years ago)
Author:
tallythemes
Message:

Added New Post Type Grid and Slider

Location:
tally-types/trunk
Files:
11 added
10 edited

Legend:

Unmodified
Added
Removed
  • tally-types/trunk/assets/css/tally-types-admin.css

    r1373491 r1546419  
    44 * Admin CSS Style of the plugin
    55**/
     6 
     7#toplevel_page_tally-types .wp-menu-image img,
     8#menu-posts-tt_slider .wp-menu-image img,
     9#menu-posts-tt_vcard .wp-menu-image img,
     10#menu-posts-tt_testimonial .wp-menu-image img,
     11#menu-posts-tt_grid .wp-menu-image img,
     12#menu-posts-tt_service .wp-menu-image img,
     13#menu-posts-tt_carousel .wp-menu-image img{
     14    opacity:1;
     15}
     16
     17
    618.tallytypes_mb_field {
    719    margin-bottom:20px;
     
    2739}
    2840.tallytypes_mb_field select{
    29     min-width:300px;   
     41    min-width:30%;
    3042}
    3143
     
    8496    display:none;
    8597}
     98
     99
     100
     101.tallytypes_mb_field input[type="button"]{
     102    width: auto;
     103}
  • tally-types/trunk/assets/js/tally-types-admin.js

    r1373491 r1546419  
    66
    77jQuery(document).ready(function($){             
     8     $( '.tt_color').wpColorPicker();
     9     
    810    //$('.tt-upload-btn').click(function(e) {
    911    $('body').on('click', '.tt-upload-btn' ,function(e) {
  • tally-types/trunk/includes/metabox-helper.php

    r1373491 r1546419  
    2525    );
    2626   
    27     if($sanitize == 'wp_kses'){
    28        $value = $sanitize($value, $tags);
    29     }else{
    30         $value = $sanitize($value);
     27    if(function_exists($sanitize)){
     28        if($sanitize == 'wp_kses'){
     29           $value = $sanitize($value, $tags);
     30        }else{
     31            $value = $sanitize($value);
     32        }
    3133    }
    3234   
     
    7476   
    7577    if ( isset( $_POST[$id] ) ){
    76         update_post_meta( $post_id, $id, tallytypes_mb_field_sanitize($sanitize, $_POST[$id]) );
     78        update_post_meta( $post_id, $id, $_POST[$id] );
    7779       
    7880    }
     
    9092    tallytypes_mb_field_before($id, $title, $class);
    9193        echo '<input type="text" name="'.$name.'" id="'.$id.'" value="'.tallytypes_mb_field_sanitize($sanitize, $value).'">';   
     94    tallytypes_mb_field_after($des);
     95}
     96
     97
     98/*  Color
     99--------------------------------------*/
     100function tallytypes_mb_field_color($arg){
     101    extract(array_merge( tallytypes_mb_field_default_arguments(), $arg ));
     102    if($name == ''){ $name = $id; }
     103   
     104    tallytypes_mb_field_before($id, $title, $class);
     105        echo '<input type="text" name="'.$name.'" id="'.$id.'" value="'.tallytypes_mb_field_sanitize($sanitize, $value).'" class="tt_color">'; 
    92106    tallytypes_mb_field_after($des);
    93107}
     
    154168            echo '<div class="ttmbf_group" id="ttmbf_group_'.$id.'">';
    155169                if(is_array($value)){
    156                     foreach($value as $valu){
     170                    foreach($value as $key => $valu){
    157171                        echo '<div class="ttmbf_group_item">';
    158172                            echo '<div class="ttmbf_group_item_header">';
     
    165179                                tallytypes_mb_field_text(array(
    166180                                    'id' => $id.'title',
    167                                     'name' => $id.'title[]',
     181                                    'name' => $id.'['.$key.'][title]',
    168182                                    'title' => "Title",
    169183                                    'value' => $valu['title'],
     
    172186                                foreach($items as $item){
    173187                                    $item['value'] = (isset($valu[$item['id']])) ? $valu[$item['id']] : '';
    174                                     $item['name'] = $id.$item['id'].'[]';
    175                                     $item['id'] = $id.$item['id'];
     188                                    $item['name'] = $id.'['.$key.']['.$item['id'].']';
     189                                    $item['id'] = $id.'-'.$key.'-'.$item['id'];
    176190                                   
    177191                                    $field_function_name = 'tallytypes_mb_field_'.$item['type'];
     
    200214                        tallytypes_mb_field_text(array(
    201215                            'id' => $id.'title',
    202                             'name' => $id.'title[]',
     216                            'name' => $id.'[__s__][title]',
    203217                            'title' => "Title",
    204218                            'value' => '',
     
    206220                        ));
    207221                        foreach($items as $item){
    208                             $item['name'] = $id.$item['id'].'[]';
    209                             $item['id'] = $id.$item['id'];
     222                            $item['name'] = $id.'[__s__]['.$item['id'].']';
     223                            $item['id'] = $id.'-__s__-'.$item['id'];
    210224                           
    211225                            $field_function_name = 'tallytypes_mb_field_'.$item['type'];
     
    215229                       
    216230                        }
    217                         echo '<input type="hidden" name="'.$id.'hidden[]" value="1">';
     231                        echo '<input type="hidden" name="'.$id.'[__s__][hidden]" value="1">';
    218232                    echo '</div>';
    219233                echo '</div>';
     
    224238    <script type="text/javascript">
    225239        jQuery(document).ready(function($){
    226             $(".ttmbf_group_sample :input").attr("disabled", true);
    227            
    228             $('#ttmbf_add_new_group_<?php echo $id; ?>').click(function(){
     240            $(".ttmbf_group_sample *").attr("disabled", true);
     241           
     242            $('#ttmbf_add_new_group_<?php echo $id; ?>').click(function(){         
    229243               
    230                 $('#ttmbf_group_sample_<?php echo $id; ?> .ttmbf_group_item').clone().appendTo("#ttmbf_group_temp_<?php echo $id; ?>");
    231                 $("#ttmbf_group_temp_<?php echo $id; ?> :input").attr("disabled", false);
    232                    
    233                 $('#ttmbf_group_temp_<?php echo $id; ?> .ttmbf_group_item').clone().appendTo("#ttmbf_group_<?php echo $id; ?>");
    234                 $('#ttmbf_group_temp_<?php echo $id; ?> .ttmbf_group_item').remove();
     244                var ttmbf_section_count = $("#ttmbf_group_<?php echo $id; ?>").children().length+1;
     245                var ttmbf_empty_section = $('#ttmbf_group_sample_<?php echo $id; ?> .ttmbf_group_item').prop('outerHTML');
     246                var ttmbf_filter_empty_section = ttmbf_empty_section.replace(/__s__/gi, ttmbf_section_count);
     247       
     248                $("#ttmbf_group_<?php echo $id; ?>").append(ttmbf_filter_empty_section);
    235249               
    236                 //$('#ttmbf_group_sample_<?php echo $id; ?> .ttmbf_group_item').clone().appendTo("#ttmbf_group_<?php echo $id; ?>");
     250                $("#ttmbf_group_<?php echo $id; ?> *").attr('disabled', false);
    237251               
    238252                return false;
     
    264278}
    265279
    266 /*  Save group
    267 --------------------------------------*/
    268 function tallytypes_mb_group_field_save($post_id, $arg){
    269     extract(array_merge( tallytypes_mb_field_default_arguments(), $arg ));
    270    
    271     $new_data = array();
    272     $count = count(  $_POST[$id.'hidden'] );
    273    
    274     for ( $i = 0; $i < $count; $i++ ) {
    275        
    276         $get_form_data = $_POST[$id.'title'];
    277         $new_data[$i]['title'] = $get_form_data[$i];
    278        
    279         if(is_array($items)){
    280             foreach($items as $item){
    281                 $get_form_data = $_POST[$id.$item['id']];
    282                 $new_data[$i][$item['id']] = $get_form_data[$i];
    283             }
    284         }
    285     }
    286 
    287     update_post_meta( $post_id, $id, $new_data );
    288        
    289 }
    290280
    291281
     
    355345                }elseif($field['type'] == 'group'){
    356346                    tallytypes_mb_field_group($field);
     347                }elseif($field['type'] == 'color'){
     348                    tallytypes_mb_field_color($field);
    357349                }
    358350            }
     
    369361        if(is_array($fields)){
    370362            foreach($fields as $field){
    371                 if($field['type'] == 'group'){
    372                     tallytypes_mb_group_field_save($post_id, $field);
    373                 }else{
    374                     tallytypes_mb_field_save($post_id, $field);
    375                 }
     363                tallytypes_mb_field_save($post_id, $field);
    376364            }
    377365        }
  • tally-types/trunk/includes/settings-page.php

    r1373491 r1546419  
    4848    add_settings_field( 'testimonials', 'Enabal Testimonial', 'tallytypes_field_render_3', 'tallytypes', 'tallytypes_pluginPage_section');
    4949    add_settings_field( 'vcard', 'Enabal vCard','tallytypes_field_render_4', 'tallytypes', 'tallytypes_pluginPage_section');
     50    add_settings_field( 'grid', 'Enabal Grid','tallytypes_field_render_5', 'tallytypes', 'tallytypes_pluginPage_section');
     51    add_settings_field( 'Slider', 'Enabal Slider','tallytypes_field_render_6', 'tallytypes', 'tallytypes_pluginPage_section');
    5052}
    5153
     
    101103    echo '</select>';
    102104}
     105function tallytypes_field_render_5(){
     106    $id = 'grid';
     107    $options = get_option( TALLYTYPES_OPTION_NAME );
     108    $value = (isset($options[$id])) ? $options[$id] : TALLYTYPES_ENABLE_GRID;
     109    $value = ($value == false) ? 0 : $value;
     110    echo '<select name="'.TALLYTYPES_OPTION_NAME.'['.$id.']">';
     111        echo '<option value="1" '.selected( $value, 1, false ).'>Yes</option>';
     112        echo '<option value="0" '.selected( $value, 0, false ).'>No</option>';
     113    echo '</select>';
     114}
     115function tallytypes_field_render_6(){
     116    $id = 'slider';
     117    $options = get_option( TALLYTYPES_OPTION_NAME );
     118    $value = (isset($options[$id])) ? $options[$id] : TALLYTYPES_ENABLE_SLIDER;
     119    $value = ($value == false) ? 0 : $value;
     120    echo '<select name="'.TALLYTYPES_OPTION_NAME.'['.$id.']">';
     121        echo '<option value="1" '.selected( $value, 1, false ).'>Yes</option>';
     122        echo '<option value="0" '.selected( $value, 0, false ).'>No</option>';
     123    echo '</select>';
     124}
  • tally-types/trunk/readme.txt

    r1373491 r1546419  
    33Tags: tallythemes, posttype, post type, services, vcard, testimonials, carousel
    44Requires at least: 4.4
    5 Tested up to: 4.4.2
    6 Stable tag: 1.0
     5Tested up to: 4.7
     6Stable tag: 2.0
    77License: GPLv2
    88License URI: http://www.gnu.org/licenses/gpl-2.0.txt
     
    2626== Frequently Asked Questions ==
    2727
    28 = What does Tally Types Setup do? =
     28= What does Tally Types do? =
    2929It just register custom post types, taxonomies and metaboxes.
    3030
     
    3737
    3838== Changelog ==
     39= 2.0 =
     40- Added new Post type Grid and Slider
     41- Added SVG icon for Admin acreen
    3942
    4043= 1.0 =
  • tally-types/trunk/tally-types.php

    r1373491 r1546419  
    77Plugin URI: http://tallythemes.com/
    88Description: Provide Custom Post Types and Metaboxes
    9 Version: 1.0
     9Version: 2.0
    1010Author: TallyThemes
    1111Author URI: http://tallythemes.com/
    1212License: GPLv2 or later
    13 Text Domain: tally-theme-setup
     13Text Domain: tally-types
    1414Prefix: tallytypes_
    1515*/
     
    4545define( 'TALLYTYPES_ENABLE_TESTIMONIALS', apply_filters('tallytypes_enable_testimonials', true) );
    4646define( 'TALLYTYPES_ENABLE_VCARD', apply_filters('tallytypes_enable_vcard', true) );
     47define( 'TALLYTYPES_ENABLE_GRID', apply_filters('tallytypes_enable_grid', true) );
     48define( 'TALLYTYPES_ENABLE_SLIDER', apply_filters('tallytypes_enable_slider', true) );
    4749
    4850include('includes/metabox-helper.php');
     
    5658$tallytypes_is_testimonials = (isset($tallytypes_options['testimonials'])) ? $tallytypes_options['testimonials'] : TALLYTYPES_ENABLE_TESTIMONIALS;
    5759$tallytypes_is_vcard = (isset($tallytypes_options['vcard'])) ? $tallytypes_options['vcard'] : TALLYTYPES_ENABLE_VCARD;
     60$tallytypes_is_grid = (isset($tallytypes_options['grid'])) ? $tallytypes_options['grid'] : TALLYTYPES_ENABLE_GRID;
     61$tallytypes_is_slider = (isset($tallytypes_options['slider'])) ? $tallytypes_options['slider'] : TALLYTYPES_ENABLE_SLIDER;
    5862
    5963if($tallytypes_is_carousel == true){
     
    6973    include('types/vcard.php');
    7074}
     75if($tallytypes_is_grid == true){
     76    include('types/grid.php');
     77}
     78if($tallytypes_is_slider == true){
     79    include('types/slider.php');
     80}
  • tally-types/trunk/types/carousel.php

    r1373491 r1546419  
    3838        'hierarchical'       => false,
    3939        'menu_position'      => 101 ,
    40         'menu_icon'          => TALLYTYPES_URL.'assets/images/carousel-icon.png',
     40        'menu_icon'          => TALLYTYPES_URL.'assets/images/carousel-icon.svg',
    4141        'supports'           => array( 'title')
    4242    );
  • tally-types/trunk/types/services.php

    r1373491 r1546419  
    3737        'hierarchical'       => false,
    3838        'menu_position'      => 101,
    39         'menu_icon'          => TALLYTYPES_URL.'assets/images/services-icon.png',
     39        'menu_icon'          => TALLYTYPES_URL.'assets/images/services-icon.svg',
    4040        'supports'           => array( 'title', 'editor', 'thumbnail' )
    4141    );
  • tally-types/trunk/types/testimonials.php

    r1373491 r1546419  
    3737        'hierarchical'       => false,
    3838        'menu_position'      => 101,
    39         'menu_icon'          => TALLYTYPES_URL.'assets/images/testimonials-icon.png',
     39        'menu_icon'          => TALLYTYPES_URL.'assets/images/testimonials-icon.svg',
    4040        'supports'           => array( 'title', 'thumbnail' )
    4141    );
  • tally-types/trunk/types/vcard.php

    r1373491 r1546419  
    3737        'hierarchical'       => false,
    3838        'menu_position'      => 101,
    39         'menu_icon'          => TALLYTYPES_URL.'assets/images/vcard-icon.png',
     39        'menu_icon'          => TALLYTYPES_URL.'assets/images/vcard-icon.svg',
    4040        'supports'           => array( 'title', 'editor', 'thumbnail' )
    4141    );
Note: See TracChangeset for help on using the changeset viewer.