Exemple #1
0
 function hb_col_shortcode($atts, $content = null)
 {
     extract(shortcode_atts(array('class' => '', 'column' => '6', 'offset' => '', 'hidemobile' => '', 'hidetablet' => '', 'animation' => ''), $atts));
     $classes = array();
     $activated = hb_shortcode_active_option_values();
     $classes[] = 'col-sm-' . $column;
     if (in_array($hidemobile, $activated)) {
         $classes[] = 'hidden-xs';
     }
     if (in_array($hidetablet, $activated)) {
         $classes[] = 'hidden-sm';
     }
     if ($offset) {
         $classes[] = 'col-sm-offset-' . $offset;
     }
     if ($animation && $animation != 'none') {
         $classes[] = 'hb-animate';
         $animation = ' data-animation="' . esc_attr($animation) . '"';
     }
     if ($class) {
         $classes[] = $class;
     }
     $classes = implode(' ', $classes);
     return '<div class="' . esc_attr($classes) . '"' . $animation . '>' . do_shortcode($content) . '</div>';
 }
Exemple #2
0
 function hb_grid_shortcode($atts, $content = null)
 {
     extract(shortcode_atts(array('class' => '', 'gutter' => ''), $atts));
     // Box Classes
     $classes = array('hb-grid', 'hb-animate-group', 'clearfix');
     $activated = hb_shortcode_active_option_values();
     if (in_array($gutter, $activated)) {
         $classes[] = 'hb-grid-gutter';
     }
     if ($class) {
         $classes[] = $class;
     }
     return '<div class="' . esc_attr(implode(' ', $classes)) . '">' . do_shortcode($content) . '</div>';
 }
Exemple #3
0
 function hb_button_shortcode($atts, $content = null)
 {
     extract(shortcode_atts(array('class' => '', 'href' => '#', 'target' => '_self', 'size' => 'normal', 'type' => 'default', 'block' => '0', 'active' => '0', 'disabled' => '0', 'icon' => ''), $atts));
     $target = trim(strtolower($target));
     $size = trim(strtolower($size));
     $type = trim(strtolower($type));
     $block = trim(strtolower($block));
     $active = trim(strtolower($active));
     $disabled = trim(strtolower($disabled));
     $icon = trim(strtolower($icon));
     $icon = $icon ? '<i class="' . $icon . '"></i> ' : '';
     $classes = array();
     $activated = hb_shortcode_active_option_values();
     $default_sizes = array('large' => 'btn-lg', 'lg' => 'btn-lg', 'small' => 'btn-sm', 'sm' => 'btn-sm', 'extrasmall' => 'btn-xs', 'extra_small' => 'btn-xs', 'xs' => 'btn-xs');
     if (isset($default_sizes[$size])) {
         $classes[] = $default_sizes[$size];
     }
     if ($type) {
         $classes[] = 'btn-' . $type;
     }
     if (in_array($block, $activated)) {
         $classes[] = 'btn-block';
     }
     if (in_array($active, $activated)) {
         $classes[] = 'active';
     }
     if (in_array($disabled, $activated)) {
         $classes[] = 'disabled';
     }
     if ($class) {
         $classes[] = $class;
     }
     if ($icon) {
         $classes[] = 'have-icon';
     }
     $classes = implode(' ', $classes);
     return '<a class="btn ' . esc_attr($classes) . '" href="' . esc_attr($href) . '" target="' . esc_attr($target) . '">' . $icon . $content . '</a>';
 }
 function hb_works_grid_shortcode($atts, $content = null)
 {
     extract(shortcode_atts(array('group' => '', 'columns' => '3', 'count' => '6', 'filter' => '', 'class' => ''), $atts));
     if (!wp_script_is('hb-worksfilter')) {
         wp_enqueue_script('hb-worksfilter');
     }
     $activated = hb_shortcode_active_option_values();
     $allowed_cols = array('2', 'double', 'two', '3', 'triple', 'three', '4', 'four');
     $work_cols = array('2' => '2', 'double' => '2', 'two' => '2', '3' => '3', 'triple' => '3', 'three' => '3', '4' => '4', 'four' => '4');
     $columns = $columns && in_array($columns, $allowed_cols) ? $work_cols[$columns] : '3';
     $count = $count == '-1' ? -1 : intval($count);
     $args = array('post_type' => 'work', 'paged' => 1, 'ignore_sticky_posts' => true);
     if ($count) {
         $args['posts_per_page'] = $count;
     }
     if ($group) {
         $args['tax_query'] = array(array('taxonomy' => 'work-group', 'terms' => explode(',', $group)));
     }
     query_posts($args);
     if (!have_posts()) {
         wp_reset_query();
         if (current_user_can('edit_theme_options')) {
             $output = "<p class='hb-error'>" . __('No Work Found!', 'glaze') . "<br/><a href='" . get_admin_url() . "post-new.php?post_type=work'>" . __('Create One!', 'glaze') . "</a>" . "</p>";
         } else {
             $output = "<p class='hb-error'>" . __('Monkeys are working on this content hardly ;)', 'glaze') . "</p>";
         }
         return $output;
     }
     $classes = array();
     $classes[] = 'hb-works hb-grid-work';
     $classes[] = 'hb-works-col-' . $columns;
     $classes[] = 'hb-masonry';
     if ($class) {
         $classes[] = $class;
     }
     $classes[] = 'clearfix';
     $classes = implode(' ', $classes);
     $uniqid = 'grid-works-' . uniqid();
     $output = '<div class="grid-works-block">';
     if (in_array($filter, $activated)) {
         if ($group) {
             $terms = get_terms('work-group', array('include' => explode(',', $group)));
         } else {
             $terms = get_terms('work-group');
         }
         if ($terms && is_array($terms) && !empty($terms)) {
             $output .= '<div class="row">';
             $output .= '<div class="col-xs-12">';
             $output .= '<div id="workfilter-' . $uniqid . '" class="hb-workfilter-handle">';
             $output .= '<div class="hb-workfilter-action hb-workfilter-active" data-workfilterclass="hb-cat-workfiltered" data-gridpostitems="#' . $uniqid . '-items">';
             $output .= '<div class="hb-workfilter-items">';
             $output .= '<div class="hb-workfilter-carousel">';
             $output .= '<div class="hb-workfilter"><span data-hbworkfilter="hb-work">' . __('All', 'glaze') . ' <em class="workfilter-balloon"></em></span></div>';
             foreach ($terms as $term) {
                 if (empty($term->slug)) {
                     continue;
                 }
                 $output .= '<div class="hb-workfilter"><span data-hbworkfilter="category-' . sanitize_html_class($term->slug, $term->term_id) . '">' . $term->name . ' <em class="workfilter-balloon"></em></span></div>';
             }
             $output .= '</div>';
             $output .= '</div>';
             $output .= '</div>';
             $output .= '</div>';
             $output .= '</div>';
             $output .= '</div>';
         }
     }
     $output .= '<div id="' . esc_attr($uniqid) . '-items" class="' . esc_attr($classes) . '">';
     while (have_posts()) {
         the_post();
         $output .= '<a href="' . get_permalink() . '" rel="bookmark" class="' . implode(' ', get_post_class("hb-work hb-masonry-item hb-animate-solo")) . '">';
         if (has_post_thumbnail()) {
             $thumb = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full');
             $output .= '<div class="box-img" style="background-image:url(' . $thumb[0] . ')"></div>';
         }
         $output .= '<h2 class="hb-work-title">' . get_the_title() . '</h2>';
         $output .= '</a>';
     }
     wp_reset_query();
     $output .= '</div>';
     $output .= '</div>';
     return $output;
 }