Example #1
0
/** ******************** Shorcode for page builder******************************** */
function st_blog_post_func($atts, $content = '')
{
    global $wp_query;
    global $post, $paged;
    $tmp_post = $post;
    extract(shortcode_atts(array('title' => '', 'cats' => array(), 'numpost' => 5, 'exclude' => '', 'orderby' => 'ID', 'order' => 'DESC', 'pbwith' => '1_1', 'type' => 1, 'site_layout' => '', 'show_title' => 'n', 'show_paging' => 'n'), $atts));
    // $wc = $builder[$i]['pbwith']; old
    $wc = $pbwith;
    // new
    $w = explode('_', $wc);
    $t = intval($w[0]);
    $m = intval($w[1]);
    if ($m > 0 and $t > 0) {
        $c = $t / $m;
    } else {
        $c = 1;
    }
    $html = '';
    // just only for one cate
    if (is_string($cats)) {
        $cats = explode(',', $cats);
    }
    if (is_array($cats) && count($cats) > 0) {
        $cat = $cats[0];
        $cat_link = $cat_title = '';
        if ($cat > 0) {
            $cat_link = get_category_link($cat);
            $cat_title = get_cat_name($cat);
        } else {
            // do some thing
        }
        if (in_array(0, $cats)) {
            $cats = array();
        }
    }
    if ($title != '') {
        $html = '
             <div class="builder-title-wrapper clearfix">
                <h3 class="builder-item-title">' . esc_html($title) . '</h3>
             </div>
             ';
    } elseif (isset($cat_link) && isset($cat_link) && $cat_link && $cat_title) {
        $html = '';
    }
    if (intval($numpost) <= 0) {
        $numpost = (int) get_option('posts_per_page', 10);
    } else {
        $numpost = intval($numpost);
    }
    $args = array('posts_per_page' => $numpost);
    if ($cats > 0) {
        $args['category__in'] = $cats;
    }
    if ($exclude != '') {
        $exclude = explode(',', $exclude);
    }
    $args['post__not_in'] = $exclude;
    $args['orderby'] = $orderby;
    $args['order'] = $order;
    if ($paged > 0) {
        $args['paged'] = $paged;
    } else {
        $paged = isset($_REQUEST['paged']) ? intval($_REQUEST['paged']) : 1;
    }
    // added in ver 1.3
    if (st_is_wpml()) {
        $args['sippress_filters'] = true;
        $args['language'] = get_bloginfo('language');
    }
    $new_query = new WP_Query($args);
    $myposts = $new_query->posts;
    $i = 0;
    if ($type == 2) {
    }
    $e = '';
    $c = 0;
    if ($type == 3 && count($myposts) % 2 != 0) {
        $myposts[] = false;
    }
    $image_size = '';
    if ($site_layout == 1 && ($pbwith == '1_1' || $pbwith == '3_4') && $type != 3) {
        $image_size = 'st_large';
    }
    // display as list
    foreach ($myposts as $post) {
        setup_postdata($post);
        if ($type == 3) {
            if ($c == 0) {
                $e .= '<div class="row">';
                $e .= '<div class="six columns b20">' . st_get_content(ST_TEMPLATE_DIR . 'loop/loop-post.php', $post, array('display_type' => $type, 'i' => $i, 'image_size' => $image_size)) . '</div>';
                $c++;
            } else {
                $e .= '<div class="six columns b20">' . st_get_content(ST_TEMPLATE_DIR . 'loop/loop-post.php', $post, array('display_type' => $type, 'i' => $i, 'image_size' => $image_size)) . '</div>';
                $e .= '<div class="clear"></div></div>';
                $c = 0;
            }
        } else {
            $e .= st_get_content(ST_TEMPLATE_DIR . 'loop/loop-post.php', $post, array('display_type' => $type, 'i' => $i, 'image_size' => $image_size));
        }
        $i++;
    }
    $html .= '<div class="loop-posts">' . $e . '</div>';
    $p = '';
    if (!is_home() && !is_front_page()) {
        // only true if not is home page or front page
        if ($show_paging == 'y') {
            $p = st_post_pagination($new_query->max_num_pages, 2, false);
            if ($p != '') {
                $p = '<div class="pagination text-left t0">' . $p . '</div>';
            }
        }
Example #2
0
function st_contact_form_func($atts, $content = '')
{
    $atts = shortcode_atts(array('to_email' => ''), $atts);
    $contact_form_template = ST_TEMPLATE_DIR . 'forms/contact.php';
    $html = '';
    if (is_file($contact_form_template)) {
        $html = st_get_content($contact_form_template, $atts, array(), true);
    }
    return $html;
}
Example #3
0
<?php

/* Template Name: Site */
get_header();
?>

<div id="hero">
	<?php 
echo st_get_headers($allPages);
?>
</div>

<section id="content">
    <div class="wrapper">
        <?php 
echo st_get_content($allPages);
?>
    </div>
</section>

<?php 
get_footer();