Plugin Directory

Changeset 2832067


Ignore:
Timestamp:
12/12/2022 02:35:08 AM (3 years ago)
Author:
madebycinza
Message:

cinza grid v1.0.9

Location:
cinza-grid
Files:
26 added
5 edited

Legend:

Unmodified
Added
Removed
  • cinza-grid/trunk/assets/css/backend-style.css

    r2802146 r2832067  
    1414#cgrid-optionset .cgrid-options {
    1515    padding: 10px;
     16    box-sizing: border-box;
    1617}
    1718
    1819#cgrid-optionset .cgrid-options.col-1 {
    19     width: 150px;
     20    width: 170px;
    2021}
    2122
     
    4445
    4546#cgrid-optionset tbody > tr:first-of-type > td {
    46     padding-top: 28px;
     47    padding-top: 28px !important;
    4748}
    4849
     
    162163/* Breakpoins */
    163164
    164 @media screen and (max-width: 1199px) {
    165 
     165@media screen and (max-width: 899px) {
     166    /* Force table to not be like tables anymore */
     167    table.cgrid-sizeset, .cgrid-sizeset thead, .cgrid-sizeset tbody, .cgrid-sizeset th, .cgrid-sizeset td, .cgrid-sizeset tr {
     168        width: 100%;
     169        display: flex;
     170        flex-wrap: wrap;
     171        align-items: center;
     172    }
     173   
     174    /* Hide table headers (but not display: none;, for accessibility) */
     175    .cgrid-sizeset tr.size-headings {
     176        position: absolute;
     177        top: -9999px;
     178        left: -9999px;
     179    }
     180   
     181    #cgrid-optionset.cgrid-sizeset td.cgrid-options.col-1 {
     182        padding: 20px 10px !important;
     183    }
     184   
     185    .cgrid-sizeset tr {
     186        overflow: hidden;
     187    }
     188   
     189    #cgrid-optionset.cgrid-sizeset td.cgrid-options {
     190        /* Behave  like a "row" */
     191        width: 100% !important;
     192        border: none;
     193        border-bottom: 1px solid #eee;
     194        position: relative;
     195        padding: 10px 10px 10px 200px !important;
     196    }
     197   
     198    .cgrid-sizeset td:before {
     199        /* Now like a table header */
     200        position: absolute;
     201        /* Top/left values mimic padding */
     202        top: 15px;
     203        left: 10px;
     204        width: 45%;
     205        padding-right: 10px;
     206        white-space: nowrap;
     207    }
     208   
     209    .cgrid-sizeset td span {
     210        margin-left: 5px;
     211    }
     212   
     213    /*
     214    Label the data
     215    */
     216    .cgrid-sizeset td:nth-of-type(1):before { content: ""; }
     217    .cgrid-sizeset td:nth-of-type(2):before { content: "Min-width"; }
     218    .cgrid-sizeset td:nth-of-type(3):before { content: "Number of columns"; }
     219    .cgrid-sizeset td:nth-of-type(4):before { content: "Items min-height"; }
     220    .cgrid-sizeset td:nth-of-type(5):before { content: "Items spacing"; }
    166221}
    167222
    168223@media screen and (max-width: 782px) {
    169 
    170 }
    171 
    172 @media screen and (max-width: 682px) {
    173 
    174 }
     224    .cgrid-sizeset td:before {top: 20px;}
     225}
     226
     227@media screen and (max-width: 599px) {
     228    #cgrid-optionset .cgrid-options.col-1 {
     229        width: 100%;
     230        display: block;
     231        padding: 10px 10px 5px;
     232    }
     233   
     234    #cgrid-optionset .cgrid-options.col-2 {
     235        width: 100%;
     236        display: block;
     237        padding: 0px 10px 10px;
     238    }
     239   
     240    .cgrid-skin-tags tr {display: block; padding-bottom: 15px;}
     241    .cgrid-skin-tags td {display: block;}
     242   
     243    #cgrid-optionset tbody > tr:first-of-type > td:not(.col-1) {
     244        padding-top: 0px !important;
     245    }
     246}
     247
     248@media screen and (max-width: 399px) {
     249    #cgrid-optionset.cgrid-sizeset td.cgrid-options {padding-left: 150px !important;}
     250   
     251    #cgrid-optionset.cgrid-sizeset .cgrid-options input[type="number"] {width: 80px;}
     252}
  • cinza-grid/trunk/cinza-grid.php

    r2813962 r2832067  
    55 * Plugin URI:        https://cinza.io/plugin/grid
    66 * Description:       A minimal grid plugin.
    7  * Version:           1.0.8
     7 * Version:           1.0.9
    88 * Requires at least: 5.2
    99 * Requires PHP:      7.2
  • cinza-grid/trunk/includes/backend-cpts.php

    r2802146 r2832067  
    4949        'hierarchical'        => false,
    5050        'exclude_from_search' => true,
    51         'publicly_queryable'  => true,
     51        'publicly_queryable'  => false, // For single post
    5252        'show_ui'             => true,
    5353        'show_in_nav_menus'   => true,
     
    172172    $temp_tax = isset($cgrid_options['cgrid_tax']) ? esc_attr($cgrid_options['cgrid_tax']) : '';
    173173    $temp_tax_terms = isset($cgrid_options['cgrid_tax_terms']) ? esc_attr($cgrid_options['cgrid_tax_terms']) : '';
    174     $temp_full_width = isset($cgrid_options['cgrid_full_width']) ? esc_attr($cgrid_options['cgrid_full_width']) : '0';
    175174    $temp_sorting = isset($cgrid_options['cgrid_sorting']) ? esc_attr($cgrid_options['cgrid_sorting']) : '';
    176175    $temp_filters = isset($cgrid_options['cgrid_filters']) ? esc_attr($cgrid_options['cgrid_filters']) : '';
     176   
     177    $temp_layout = isset($cgrid_options['cgrid_layout']) ? esc_attr($cgrid_options['cgrid_layout']) : 'fitRows';
     178    $temp_full_width = isset($cgrid_options['cgrid_full_width']) ? esc_attr($cgrid_options['cgrid_full_width']) : '0';
    177179    $temp_query_string = isset($cgrid_options['cgrid_query_string']) ? esc_attr($cgrid_options['cgrid_query_string']) : '0';
    178180   
     
    308310        </thead>
    309311        <tbody>
     312            <tr>
     313                <td class="cgrid-options col-1">
     314                    <label for="cgrid_layout">Layout mode</label>
     315                </td>
     316                <td class="cgrid-options col-2">
     317                    <select name="cgrid_layout" id="cgrid_layout">
     318                        <option value="fitRows" <?php if(isset($temp_layout) && ($temp_layout == 'fitRows'))  echo 'selected="selected"'; ?>>FitRows</option>
     319                        <option value="masonry" <?php if(isset($temp_layout) && ($temp_layout == 'masonry'))  echo 'selected="selected"'; ?>>Masonry</option>
     320                    </select>
     321                </td>
     322            </tr>
    310323            <tr>
    311324                <td class="cgrid-options col-1">
     
    427440                <td class="cgrid-options col-1" colspan="2">
    428441                    <p><strong>Enter the code and buttons of each element that will be used for filtering.</strong></p>
    429                     <p>Format: <code>meta / label / buttons separated by comma</code> (one per line)</p>
     442                    <p>Format: <code>meta / "All" button / buttons separated by comma</code> (one per line)</p>
    430443                    <textarea type="text" class="widefat cgrid-content" name="cgrid_filters"><?php echo esc_html($temp_filters); ?></textarea>
    431444                </td>
     
    448461                        <li>Filters only work with <code>%meta('field_name')%</code> and <code>%tax('taxonomy_name')%</code>.</li>
    449462                        <li>To filter by the 'color' meta field, with the default button called "All Colors" and filters for the colors Blue, Red and Yellow, you should enter the following in the Filter textarea:</li>
    450                         <li><code>%meta('color')% / Colors / Blue, Red, Yellow</code></li>                     
     463                        <li><code>%meta('color')% / All Colors / Blue, Red, Yellow</code></li>                     
    451464                    </ul>
    452465                </td>
     
    616629    $cgrid_tax              = isset($_POST['cgrid_tax']) ? wp_filter_post_kses($_POST['cgrid_tax']) : '';
    617630    $cgrid_tax_terms        = isset($_POST['cgrid_tax_terms']) ? wp_filter_post_kses($_POST['cgrid_tax_terms']) : '';
    618     $cgrid_full_width       = isset($_POST['cgrid_full_width']) ? sanitize_key($_POST['cgrid_full_width']) : '';
    619631    $cgrid_sorting          = isset($_POST['cgrid_sorting']) ? wp_filter_post_kses($_POST['cgrid_sorting']) : '';
    620632    $cgrid_filters          = isset($_POST['cgrid_filters']) ? wp_filter_post_kses($_POST['cgrid_filters']) : '';
     633   
     634    $cgrid_layout           = isset($_POST['cgrid_layout']) ? sanitize_key($_POST['cgrid_layout']) : '';
     635    $cgrid_full_width       = isset($_POST['cgrid_full_width']) ? sanitize_key($_POST['cgrid_full_width']) : '';
    621636    $cgrid_query_string     = isset($_POST['cgrid_query_string']) ? sanitize_key($_POST['cgrid_query_string']) : '';
    622637   
     
    653668    $new['cgrid_tax'] = empty($cgrid_tax) ? '' : wp_strip_all_tags($cgrid_tax);
    654669    $new['cgrid_tax_terms'] = empty($cgrid_tax_terms) ? '' : wp_strip_all_tags($cgrid_tax_terms);
    655     $new['cgrid_full_width'] = $cgrid_full_width ? '1' : '0';
    656670    $new['cgrid_sorting'] = empty($cgrid_sorting) ? '' : wp_filter_post_kses($cgrid_sorting);
    657671    $new['cgrid_filters'] = empty($cgrid_filters) ? '' : wp_filter_post_kses($cgrid_filters);
     672   
     673    $new['cgrid_layout'] = empty($cgrid_layout) ? 'fitRows' : wp_strip_all_tags($cgrid_layout);
     674    $new['cgrid_full_width'] = $cgrid_full_width ? '1' : '0';
    658675    $new['cgrid_query_string'] = $cgrid_query_string ? '1' : '0';
    659676   
  • cinza-grid/trunk/includes/backend-shortcodes.php

    r2802146 r2832067  
    4646    $cgrid_tax = isset($cgrid_options['cgrid_tax']) ? esc_attr($cgrid_options['cgrid_tax']) : '';
    4747    $cgrid_tax_terms = isset($cgrid_options['cgrid_tax_terms']) ? esc_attr($cgrid_options['cgrid_tax_terms']) : '';
    48     $cgrid_full_width = isset($cgrid_options['cgrid_full_width']) ? esc_attr($cgrid_options['cgrid_full_width']) : '0';
    4948    $cgrid_sorting = isset($cgrid_options['cgrid_sorting']) ? esc_attr($cgrid_options['cgrid_sorting']) : '';
    5049    $cgrid_filters = isset($cgrid_options['cgrid_filters']) ? esc_attr($cgrid_options['cgrid_filters']) : '';
     50   
     51    $cgrid_layout = isset($cgrid_options['cgrid_layout']) ? esc_attr($cgrid_options['cgrid_layout']) : 'fitRows';
     52    $cgrid_full_width = isset($cgrid_options['cgrid_full_width']) ? esc_attr($cgrid_options['cgrid_full_width']) : '0';
    5153    $cgrid_query_string = isset($cgrid_options['cgrid_query_string']) ? esc_attr($cgrid_options['cgrid_query_string']) : '0';
    5254
     
    173175                       
    174176                        // First button
    175                         $filters .= '<button class="button is-checked" data-filter="*">All '. trim($filter_atts[1]) .'</button>';
     177                        $filters .= '<button class="button is-checked" data-filter="*">'. trim($filter_atts[1]) .'</button>';
    176178                       
    177179                        // All other buttons
    178180                        $filter_buttons = explode (",", $filter_atts[2]);
    179181                        foreach ($filter_buttons as $filter_button) {
    180                             $button_dashed = str_replace(' ', '-', trim(strtolower($filter_button)));
    181                             $filters .= '<button class="button" id="'. $button_dashed .'" data-filter=".'. $button_dashed .'">'. trim($filter_button) .'</button>';
     182                            $characters = array("&amp;", " ", "---");
     183                            $encoded_classes = str_replace($characters, '-', trim(strtolower($filter_button)));
     184                            $filters .= '<button class="button" id="'. $encoded_classes .'" data-filter=".'. $encoded_classes .'">'. trim($filter_button) .'</button>';
    182185                        }
    183186                    $filters .= '</div>';                   
     
    186189        $filters .= '</div>';       
    187190    }
     191   
     192    if ($cgrid_layout == "fitrows") $cgrid_layout = "fitRows";
    188193   
    189194    $script = "<script>
     
    193198        ({
    194199            itemSelector: '.cinza-grid-item',
    195             layoutMode: 'fitRows',
     200            layoutMode: '".$cgrid_layout."',
    196201            transitionDuration: '0.4s',
    197202            getSortData: {".$sorts_data."}
     
    528533            );
    529534           
    530             $grid .= '<div class="cinza-grid-item cinza-grid-'. $post->ID . $filter_classes.'">'. str_replace($code1, $code2, $grid_item) .'</div>';
     535            $characters = array("&amp;", "---");
     536            $encoded_classes = str_replace($characters, '-', strtolower($filter_classes));
     537            $grid .= '<div class="cinza-grid-item cinza-grid-'. $post->ID . $encoded_classes.'">'. str_replace($code1, $code2, $grid_item) .'</div>';
    531538        }
    532539    }
     
    542549    $style .= "</style>";
    543550   
    544     return $debug . $sorts . $filters . $grid . $style . $script;
     551    //return $debug . $sorts . $filters . $grid . $style . $script;
     552    return $sorts . $filters . $grid . $style . $script;
    545553}
    546554
  • cinza-grid/trunk/readme.txt

    r2813962 r2832067  
    55Tested up to: 6.1
    66Requires PHP: 7.2
    7 Stable tag: 1.0.8
     7Stable tag: 1.0.9
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    2222
    2323== Changelog ==
     24
     25= 1.0.9 =
     26*Release Date - 11th December, 2022*
     27
     28* Added layout modes (fitRow and masonry)
     29* Fixed filter button "All" placeholder
     30* Fixed filter buttons to accept the special character &
     31* Disabled single posts
     32* Backend responsiveness improvements
    2433
    2534= 1.0.8 =
Note: See TracChangeset for help on using the changeset viewer.