Example #1
0
 public static function get_instance()
 {
     if (!self::$instance) {
         self::$instance = new DT_Shortcode_BlogPosts();
     }
     return self::$instance;
 }
            $config->set('post.preview.load.effect', $atts['loading_effect'], 'fade_in');
            $config->set('post.preview.width.min', $atts['column_width']);
            $config->set('template.posts_filter.terms.enabled', $atts['show_filter']);
            $config->set('template.posts_filter.orderby.enabled', $atts['show_orderby']);
            $config->set('template.posts_filter.order.enabled', $atts['show_order']);
            $config->set('order', $atts['order']);
            $config->set('orderby', $atts['orderby']);
        }
        protected function compatibility_filter(&$atts)
        {
            // detect old shortcode
            if (!isset($atts['columns_number']) && isset($atts['column_width'])) {
                // columns adaptation
                $abs_column_width = absint($atts['column_width']);
                if ($abs_column_width) {
                    $atts['columns_number'] = intval(round(1200 / $abs_column_width));
                }
                $atts['fancy_date'] = 'true';
                $atts['show_excerpts'] = 'true';
                $atts['show_read_more_button'] = 'true';
                $atts['show_post_categories'] = 'true';
                $atts['show_post_date'] = 'true';
                $atts['show_post_author'] = 'true';
                $atts['show_post_comments'] = 'true';
            }
            return $atts;
        }
    }
    // create shortcode
    DT_Shortcode_BlogPosts::get_instance();
}