Пример #1
0
    </div>
    <!-- end stpb_pd_w -->
<?php 
}
// end st_page_builder
/** ============================================================== */
function stpb_column_class($pbwith)
{
    $class = "";
    $w = explode('_', $pbwith);
    $w[0] = intval($w[0]);
    $w[1] = intval($w[1]);
    if ($w[0] == 0 or $w[1] == 0) {
        $n = 12;
    } else {
        $n = 12 * ($w[0] / $w[1]);
        // 12 columns
    }
function stpb_clients_generate($data, $type = '')
{
    $actitle = '';
    if ($data['settings']['title'] != '') {
        $actitle = '
        <div class="builder-title-wrapper clearfix">
            <h3 class="builder-item-title">' . esc_html($data['settings']['title']) . '</h3>
         </div>
        ';
    }
    $target = '';
    if ($data['settings']['target'] != '') {
        if ($data['settings']['target'] == '_self' || $data['settings']['target'] == '_blank') {
            $target = ' target="' . $data['settings']['target'] . '" ';
        }
    }
    $html = '';
    $items = '';
    $num_col = isset($data['settings']['num_col']) && intval($data['settings']['num_col']) > 0 ? intval($data['settings']['num_col']) : 4;
    $class_name = stpb_number_to_text(12 / $num_col);
    $i = 1;
    if ($data['ui_data']) {
        foreach ($data['ui_data'] as $k => $d) {
            $item = '';
            if ($d['img'] != '') {
                $item = '<img src="' . esc_url($d['img']) . '" alt="' . esc_attr($d['title']) . '"/>';
            }
            if ($d['url'] != '') {
                $item = ' <a href="' . esc_url($d['url']) . '" ' . $target . ' title="' . esc_attr($d['title']) . '">' . $item . '</a>';
            }
            if ($item != '') {
                $items .= '<div class="' . $class_name . ' item columns b10' . ($i == 1 ? ' start' : ($i == $num_col ? ' end' : '')) . '">' . $item . '</div>';
            }
            if ($i == $num_col) {
                $items .= '<div class="clear"></div>';
                $i = 1;
            } else {
                $i++;
            }
        }
    }
    $id = uniqid();
    $html = '<div class="clients-wrap  builder-item-wrapper">
            ' . $actitle . '
            <div class="st-clients" id="caro-' . $id . '">
                ' . $items . '
                <div class="clear"></div>
            </div>
        </div>';
    return $html;
}
Пример #3
0
function st_post_gallery_func($atts, $content = '')
{
    global $wp_query;
    global $post;
    $tmp_post = $post;
    extract(shortcode_atts(array('title' => 0, 'cats' => '', 'numpost' => 6, 'exclude' => '', 'orderby' => 'ID', 'order' => 'DESC', 'pbwith' => '1_1', 'num_col' => 4, 'site_layout' => '', 'show_heading' => 'y', 'filter_type' => 'default', 'custom_filter_text' => '', 'custom_filter_url' => '', 'row_index' => 9), $atts));
    $wc = $pbwith;
    $w = explode('_', $wc);
    $t = intval($w[0]);
    $m = intval($w[1]);
    if ($m > 0 and $t > 0) {
        $c = $t / $m;
    } else {
        $c = 1;
    }
    $html = $heading = $htitle = '';
    if ($show_heading != 'n') {
        if ($title != '') {
            $f_class = '';
            $htitle = esc_html($title);
        } else {
            $f_class = " hide-heading ";
        }
        $filter = '';
        $is_filter = false;
        if ($filter_type == 'default') {
            $terms = get_terms('gallery_tag', array('include' => $cats, 'fields' => 'all'));
            $filter = '<ul data-option-key="filter" class="cpt-filters' . $f_class . '">
                    <li><a class="selected" href="#filter=*">' . __('All', 'smooththemes') . '</a></li>';
            foreach ($terms as $term) {
                $filter .= '<li><a  href="#filter=.' . esc_attr($term->slug) . '">' . esc_html(stripslashes($term->name)) . '</a></li>';
            }
            $filter .= '</ul>';
            $is_filter = true;
        } else {
            if ($custom_filter_text != '') {
                if (trim($custom_filter_url) == '') {
                    $custom_filter_url = '#';
                }
                $filter = '<a class="view-all" href="' . esc_attr($custom_filter_url) . '">' . esc_html($custom_filter_text) . '</a>';
            }
        }
        $heading = '<div class="builder-title-wrapper clearfix' . ($is_filter && $row_index == 1 ? '  has_filter' : '  no_filter') . '">
                        <h3 class="builder-item-title">' . ($is_filter && $row_index == 1 ? '' : $htitle) . '</h3>
                        <div class="builter-title-alt right">
                            ' . $filter . '
                        </div>
                        <div class="clear"></div>
                    </div>';
    }
    // end show heading
    if (intval($numpost) > 0) {
        $numpost = intval($numpost);
    } else {
        $numpost = -1;
        // get all portfolio
    }
    $args = array('posts_per_page' => $numpost);
    if ($exclude != '') {
        $exclude = explode(',', $exclude);
    }
    $args['post__not_in'] = $exclude;
    $args['orderby'] = $orderby;
    $args['order'] = $order;
    $args['post_type'] = 'gallery';
    if (!empty($cats)) {
        $args['tax_query'] = array('relation' => 'AND', array('taxonomy' => 'gallery_tag', 'field' => 'id', 'terms' => explode(',', $cats), 'operator' => 'IN'));
    }
    // added in ver 1.3
    if (st_is_wpml()) {
        $args['sippress_filters'] = true;
        $args['language'] = get_bloginfo('language');
    }
    //  echo var_dump($wp_query);
    $new_query = new WP_Query($args);
    //$myposts =  $wp_query->query($args);
    $myposts = $new_query->posts;
    $num_col = intval($num_col) > 0 ? intval($num_col) : 4;
    $e = '';
    $c = 0;
    $i = 1;
    if (!isset($type)) {
        $type = '';
    }
    $image_size = 'st_medium';
    // echo $num_col;
    $col_txt = stpb_number_to_text(12 / $num_col);
    foreach ($myposts as $post) {
        setup_postdata($post);
        $term_list = wp_get_post_terms($post->ID, 'gallery_tag', array("fields" => "all"));
        $filter_class = array();
        foreach ($term_list as $term) {
            $filter_class[] = $term->slug;
        }
        $ptitle = the_title_attribute('echo=0');
        $title = sprintf(esc_attr__('Permalink to %s', 'smooththemes'), $ptitle);
        $link = get_permalink($post->ID);
        $image_data = get_post_meta($post->ID, '_st_gallery', true);
        $n = count($image_data['images']);
        if ($n == 1) {
            $caption = sprintf(__('Total %s photo', 'smooththemes'), $n);
        } else {
            $caption = sprintf(__('Total %s photos', 'smooththemes'), $n);
        }
        $caption = '<div class="cpt-desc">' . $caption . '</div>';
        $html .= '<div class="cpt-item item-isotope ' . $col_txt . ' columns b30 ' . esc_attr(join(' ', $filter_class)) . '">
                            <div class="thumb-wrapper">
                                ' . st_images_thumb($image_data) . '
                            </div>
                             <div class="cpt-detail">
                                <h2 class="cpt-title">' . get_the_title($post->ID) . '</h2>
                                ' . $caption . '
                            </div>   
                        </div>';
        if ($i >= $num_col) {
            $html .= '<div class="clear"></div>';
            $i = 1;
        } else {
            $i++;
        }
    }
    wp_reset_query();
    return '<div class="builder-item-wrapper builder-gallery ">
                ' . $heading . '
                <div class="builder-item-content row' . ($is_filter ? ' has-isotope' : ' no-isotope') . '">
                    <div class="twelve columns b0">
                        <div class="cpt-items row clearfix isotope">
                        ' . do_shortcode($html) . '
                        </div>
                    </div>
                </div>
              
            </div>';
}
Пример #4
0
                        </div>';
        if ($i >= $num_col) {
            $html .= '<div class="clear"></div>';
            $i = 1;
        } else {
            $i++;
        }
    }
    wp_reset_query();
    return '<div class="builder-item-wrapper builder-portfolio">
                ' . $heading . '
                <div class="builder-item-content row' . ($is_filter ? ' has-isotope' : ' no-isotope') . '">
                    <div class="twelve columns b0">
                        <div class="cpt-items row clearfix isotope">
                        ' . do_shortcode($html) . '
                        </div>
                    </div>
                </div>
            </div>';
}
add_shortcode('portfolio', 'st_portfolio_func');
// for entry content
function st_this_entry_func($atts, $content = '')
{
    global $post;
    return apply_filters('the_content', $post->post_content);
}
add_shortcode('this_entry', 'st_this_entry_func');
function st_shorcode_alert_func($atts, $content = '')
{
    extract(shortcode_atts(array('alert_type' => ''), $atts));
    if ($alert_type != '') {
        $alert_type = ' alert-' . $alert_type;
    }
    $html = '<div class="alert' . $alert_type . '"><a class="close" href="#"><i class="icon-remove"></i></a>' . do_shortcode($content) . '<div class="clear"></div></div>';
    return $html;
}
add_shortcode('alert', 'st_shorcode_alert_func');
function st_post_gallery_func($atts, $content = '')
{
    global $wp_query;
    global $post;
    $current_post_id = $post;
    extract(shortcode_atts(array('title' => 0, 'cats' => '', 'numpost' => 6, 'exclude' => '', 'orderby' => 'ID', 'order' => 'DESC', 'pbwith' => '1_1', 'num_col' => 4, 'site_layout' => '', 'black_and_white' => '', 'lightbox' => '', 'row_index' => 9), $atts));
    $item_title = '';
    if ($title != '') {
        $item_title = '<h3 class="builder-item-title">' . esc_html($title) . '</h3>';
    }
    $paged = get_query_var('paged') ? get_query_var('paged') : 1;
    if (intval($numpost) > 0) {
        $numpost = intval($numpost);
    } else {
        $numpost = get_option('gallery_num_item', 10);
        // get all portfolio
    }
    $args = array('posts_per_page' => $numpost);
    if ($exclude != '') {
        $exclude = explode(',', $exclude);
    }
    $args['post__not_in'] = $exclude;
    $args['orderby'] = $orderby;
    $args['order'] = $order;
    $args['post_type'] = 'gallery';
    $args['paged'] = $paged;
    if (!empty($cats)) {
        $args['tax_query'] = array('relation' => 'AND', array('taxonomy' => 'gallery_tag', 'field' => 'id', 'terms' => explode(',', $cats), 'operator' => 'IN'));
    }
    // added in ver 1.3
    if (st_is_wpml()) {
        $args['sippress_filters'] = true;
        $args['language'] = get_bloginfo('language');
    }
    //  echo var_dump($wp_query);
    $new_query = new WP_Query($args);
    $myposts = $new_query->posts;
    $num_col = intval($num_col) > 0 ? intval($num_col) : 4;
    $next_page_link = '';
    if ($paged < $new_query->max_num_pages) {