Plugin Directory

Changeset 1880126


Ignore:
Timestamp:
05/23/2018 02:36:12 PM (8 years ago)
Author:
matt.burnett
Message:

0.8.7

  • Add "do not show" in masonry checkbox in post metabox
  • Add custom styling checkbox in post metabox
Location:
yumjam-masonry-layout-for-posts-and-custom-post-types/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • yumjam-masonry-layout-for-posts-and-custom-post-types/trunk/class/masonry_custom_cpt.php

    r1866847 r1880126  
    409409            $meta = array(
    410410                //('input type', 'name/id', 'placeholder text', 'Label text', 'value')
    411                 'enabled' => array('checkbox', 'enabled', '', 'Show in Masonry', 'on'),
     411                'enabled' => array('checkbox', 'enabled', '', 'Customise Styling', 'on'),
     412                'do_not_show' => array('checkbox', 'do_not_show', '', 'Do not Show in Masonry', 'off'),
    412413                'columns' => array('select', 'columns', '0', 'Columns to span', $this->col_val),
    413414                'header_label' => array('group', '', '', 'Masonry header options', ''),
     
    451452            global $post;
    452453            $enabled = get_post_meta($post->ID, 'custom_enabled', true);
     454            $do_not_show = get_post_meta($post->ID, 'custom_do_not_show', true);
    453455            ob_start();
    454456            ?>
     
    457459                    <div class="masonry-col-sm-13 ">
    458460                        <p class="form-field yj-cpt-input">
    459                             <label for="enabled">Show in Masonry</label>
     461                            <label for="do_not_show">Do not Show in Masonry</label>
     462                            <input class="short" type="checkbox" id="custom_do_not_show" name="custom_do_not_show" <?php if ($do_not_show == 'on') { echo ' checked="true"'; }; ?> >                           
     463                            <label for="enabled">Customise Styling</label>
    460464                            <input class="short" type="checkbox" id="custom_enabled" name="custom_enabled" <?php if ($enabled == 'on') { echo ' checked="true"'; }; ?> >
    461465                        </p>
     
    466470                    <?php
    467471                    foreach ($meta as $id => $i) {
    468                         if ($id != 'enabled') {
    469                             echo $this->input_box($i[0], $i[1], $i[2], $i[3], empty($i[4])?'':$i[4], empty($i[5])?'':$i[5], empty($i[6])?'':$i[6]);
     472                        if ($id == 'enabled' || $id == 'do_not_show') {
     473                            //Skip these in meta box
     474                        } else {
     475                            echo $this->input_box($i[0], $i[1], $i[2], $i[3], empty($i[4])?'':$i[4], empty($i[5])?'':$i[5], empty($i[6])?'':$i[6]);                           
    470476                        }
    471477                    }
     
    562568
    563569            if (empty($post_data['custom_enabled'])) {
    564                 update_post_meta($post_id, 'custom_enabled', 'on');
     570                update_post_meta($post_id, 'custom_enabled', 'off');
    565571            } else {
    566572                update_post_meta($post_id, 'custom_enabled', $post_data['custom_enabled']);
    567573            }
     574           
     575            if (empty($post_data['custom_do_not_show'])) {
     576                update_post_meta($post_id, 'custom_do_not_show', 'off');
     577            } else {
     578                update_post_meta($post_id, 'custom_do_not_show', $post_data['custom_do_not_show']);
     579            }           
    568580
    569581            if (in_array($post->post_type, $this->supported_post_types) && !empty($post_data)) {
  • yumjam-masonry-layout-for-posts-and-custom-post-types/trunk/readme.txt

    r1866847 r1880126  
    5050== Changelog ==
    5151
     52= 0.8.7 =
     53* Add "do not show" in masonry checkbox in post metabox
     54* Add custom styling checkbox in post metabox
     55
    5256= 0.8.6 =
    5357* Add general settings to enable/disabled some supported post types
  • yumjam-masonry-layout-for-posts-and-custom-post-types/trunk/yumjam_masonry.php

    r1866847 r1880126  
    1313 * Plugin URI: https://www.yumjam.co.uk/yumjam-wordpress-plugins/wp-masonry-plugin/
    1414 * Description: Easily display Wordpress posts or custom post type entries within a tidy masonry style wall layout.
    15  * Version: 0.8.6
     15 * Version: 0.8.7
    1616 * Author: YumJam
    1717 * Author URI: https://www.yumjam.co.uk
     
    2121 * Tags: masonry, wall, post display, brick layout, wall layout, blog layout, shortcode, pintrest, news layout, lazy loading, ajax loading
    2222 * Requires at least: 4.0
    23  * Tested up to: 4.9.5
    24  * Stable tag: 4.9.5
     23 * Tested up to: 4.9.6
     24 * Stable tag: 4.9.6
    2525 */
    2626if (!defined('ABSPATH')) {
     
    420420
    421421        function manage_custom_posts_columns($columns) {
    422             $columns['custom_enabled'] = esc_html__('Enabled in Masonry');
     422            $columns['custom_do_not_show'] = esc_html__('Hide in Masonry');
    423423            return $columns;
    424424        }
    425425       
    426426        function remove_dummy_column($columns){
    427             unset($columns['custom_enabled']);
     427            unset($columns['custom_do_not_show']);
    428428            return $columns;
    429429        }
    430430       
    431431        function on_bulk_edit_custom_box($column_name, $post_type){
    432             if ('custom_enabled' == $column_name) {
    433                 echo esc_html__('Enabled in Masonry');
     432            if ('custom_do_not_show' == $column_name) {
     433                echo esc_html__('Hide in Masonry');
    434434            }
    435435        }
     
    623623                //if (!empty($atts[$key])) {
    624624                    if (!empty($atts[$key]) || ($atts["block_spacing"]=="0" && $key=="block_spacing")) {
    625                        
    626625                        $this->options[$key] = $atts[$key];
    627626                    }
     
    634633                'posts_per_page' => $this->options['default_per_page'],
    635634                'paged' => empty($atts['paged']) ? '' : ($atts['paged']),
    636                 'meta_query' => array(
     635            );
     636           
     637            //Ignore the show hide check box if wp meta box is disabled
     638            if (get_option('yjm_disable_post_metabox') != 1) {
     639                $args['meta_query'] = array(
     640                    'relation' => 'OR',
    637641                    array(
    638                         'key' => 'custom_enabled',
     642                        'key' => 'custom_do_not_show',
    639643                        'value' => 'off',
    640                         'compare' => '!='
    641                     )
    642                 )
    643             );
     644                        'compare' => '=='
     645                    ),
     646                    array(
     647                        'key' => 'custom_do_not_show',
     648                        'compare' => 'NOT EXISTS',
     649                        'value' => ''
     650                    )                   
     651                );
     652            }
    644653
    645654            if (!empty($this->options['post_cats']) && $this->options['post_cats'] != 'all') {
Note: See TracChangeset for help on using the changeset viewer.