Exemplo n.º 1
0
<?php

$output = $el_class = '';
extract(shortcode_atts(array('el_class' => '', 'row_type' => 'row', 'type' => '', 'background_img_id' => '', 'background_color' => '', 'min_height' => '500', 'parallax_speed' => '14', 'parallax_position' => '50', 'video_height' => '550px', 'video_mp4' => '', 'video_webm' => '', 'video_image' => '', 'overlay_texture' => '', 'overlay_color' => '', 'overlay_opacity' => '', 'row_padding_top' => '', 'row_padding_bottom' => '', 'row_padding_right' => '', 'row_padding_left' => '', 'row_margin_top' => '', 'row_margin_bottom' => '', 'equal_height' => 'no'), $atts));
wp_enqueue_style('js_composer_front');
wp_enqueue_script('wpb_composer_front_js');
wp_enqueue_style('js_composer_custom_css');
// generate uniqe id for Row
$id = ep_sc_id('vc_row');
if (is_numeric($overlay_opacity)) {
    if (floatval($overlay_opacity) > 1) {
        $overlay_opacity = '1';
    } elseif (floatval($overlay_opacity) < 0) {
        $overlay_opacity = '0';
    }
} else {
    $overlay_opacity = '';
}
$rowspace = "";
//row spacing
if ($row_padding_top != "" || $row_padding_bottom != "" || $row_padding_left != "" || $row_padding_right != "" || $row_margin_top != "" || $row_margin_bottom != "") {
    if ($row_padding_top != "") {
        $rowspace .= 'padding-top:' . $row_padding_top . 'px;';
    }
    if ($row_padding_bottom != "") {
        $rowspace .= 'padding-bottom:' . $row_padding_bottom . 'px;';
    }
    if ($row_padding_right != "") {
        $rowspace .= 'padding-right:' . $row_padding_right . 'px;';
    }
    if ($row_padding_left != "") {
Exemplo n.º 2
0
function ep_sc_gallery($atts)
{
    extract(shortcode_atts(array('type' => 'portfolio_space', 'title_bar' => 'show', 'title_text' => '', 'subtitle_text' => '', 'portfolio_filter' => 'all', 'filters' => '', 'filter_display' => 'show', 'filter_style' => 'standard', 'filter_toggle_state' => 'close', 'gallery_posts_page' => '12', 'portfolio_hover_like_button' => 'show', 'portfolio_hover' => 'simpleGallery', 'portfolio_hover_style' => 'lightStyle'), $atts));
    $id = ep_sc_id('portfolio');
    $portolio_type = $type;
    $title = $title_text;
    $pDajax = false;
    $portfolioId = $id;
    $id = str_replace('portfolio_', '', $id);
    $portfolioLoop = 'pLoop_' . $id;
    $pLoadMore = 'pLoadMore_' . $id;
    $pagedNum = 'paged_' . $id;
    $catArr = array();
    $portfolioItemNumber = 0;
    /* get all of the gallery categories if there is none of them was selected*/
    if ($portfolio_filter == 'all') {
        $args = array('fields' => 'ids');
        $filters = get_terms('gallery_cat', $args);
        $catArr = $filters;
        $portfolioItemNumber = wp_count_posts('gallery')->publish;
    } else {
        $catArr = explode(',', $filters);
        $args = array('fields' => 'ids', 'posts_per_page' => -1, 'post_type' => 'gallery', 'tax_query' => array(array('taxonomy' => 'gallery_cat', 'field' => 'slug', 'terms' => $catArr)));
        $ps = get_posts($args);
        $portfolioItemNumber = count($ps);
        $args = array('fields' => 'ids', 'slug' => $catArr);
        $filters = get_terms('gallery_cat', $args);
    }
    if (count($catArr) == 0 || count($catArr) > 1) {
        if ($portfolio_filter == 'all') {
            // Generate All Filter Taxonomy
            $listCatsArgs = array('title_li' => '', 'taxonomy' => 'gallery_cat', 'walker' => new Ep_portfolio_walker(), 'echo' => 0, 'include' => '');
        } else {
            // Generate  Selected Taxonomy
            $listCatsArgs = array('title_li' => '', 'taxonomy' => 'gallery_cat', 'walker' => new Ep_portfolio_walker(), 'echo' => 0, 'include' => implode(",", $filters));
        }
        $catList = '<li class="current"><a class="active" data-filter="*" href="#">' . __('All', 'epicomedia') . '<span class="filterline"></span><span class="post-count">' . sprintf("%02d", $portfolioItemNumber) . '</span></a></li>';
        $catList .= wp_list_categories($listCatsArgs);
    }
    if ($portfolio_filter == 'custom') {
        $gallery_cats = array();
        $cat_args = array('orderby' => 'term_id', 'order' => 'ASC', 'hide_empty' => false, 'slug' => $catArr);
        $terms = get_terms('gallery_cat', $cat_args);
        foreach ($terms as $taxonomy) {
            $gallery_cats[] = $taxonomy->term_id;
        }
        // Add some parameters for the JS - gallery load more .
        $queryArgs = array('post_type' => 'gallery', 'post_status' => 'publish', 'posts_per_page' => -1, 'fields' => 'ids', 'pageVar' => 'list1', 'tax_query' => array(array('taxonomy' => 'gallery_cat', 'terms' => $gallery_cats)));
    } else {
        // Add some parameters for the JS - gallery load more .
        $queryArgs = array('post_type' => 'gallery', 'post_status' => 'publish', 'posts_per_page' => -1, 'fields' => 'ids', 'pageVar' => 'list1');
    }
    $query = new WP_Query($queryArgs);
    $ppaged = get_query_var('paged') > 1 ? get_query_var('paged') : 1;
    $pMax = $query->max_num_pages;
    $countPosts = $query->found_posts;
    $maxPages = ceil($countPosts / $gallery_posts_page);
    wp_reset_postdata();
    ob_start();
    ?>

    <!-- gallery Section  -->
    <div id="<?php 
    echo $portfolioId;
    ?>
" data-portfolio-type="<?php 
    echo esc_attr($type);
    ?>
" data-value="<?php 
    echo $portfolioId;
    ?>
"  data-id="<?php 
    echo $id;
    ?>
" data-startPage="<?php 
    echo $ppaged;
    ?>
" data-maxPages="<?php 
    echo $maxPages;
    ?>
" data-nextLink="<?php 
    echo next_posts($pMax, false);
    ?>
" class="epicoSection portfolioSection <?php 
    echo esc_attr($type);
    ?>
 <?php 
    if ($portfolio_hover_like_button == 'hide') {
        ?>
 hideLikeBtn <?php 
    }
    ?>
">

        <div  class="portfoliowrap wrap">

            <div class="container title_container <?php 
    if ($title_bar == 'show' && !empty($title) || $filter_display == 'show') {
        ?>
 portfolio_height <?php 
    }
    ?>
 clearfix">

                <?php 
    if (!empty($title) || $title_bar == 'show') {
        ?>
                
                        <?php 
        if ($title_bar == 'show') {
            ?>
                            <div class="titleSpace">
                    
                                <?php 
            if (!empty($title)) {
                ?>
                                
                                    <div class="title"><h3><?php 
                echo esc_attr($title);
                ?>
</h3></div>
									
                                <?php 
            }
            ?>
                        
                            </div>
                        <?php 
        }
        ?>
                        
                    
                <?php 
    }
    ?>
                
            </div>

            <?php 
    if ($filter_display == 'show') {
        if (count($catArr) !== 1) {
            ?>

                    <!-- gallery filter - desktop -->
                    <div class="container title_container visible-desktop clearfix">
                        <div class="portfolio-header">
                        
                            <ul class="filters option-set subnavigation clearfix <?php 
            echo esc_attr($filter_style);
            ?>
-style toggleClicked<?php 
            if ($filter_toggle_state == "open") {
                echo " openToggle";
            }
            ?>
" data-option-key="filter">

                                <?php 
            echo $catList;
            if ($filter_style == 'toggle') {
                ?>
                                    <li class="filterToggle<?php 
                if ($filter_toggle_state == "open") {
                    echo " closed";
                }
                ?>
">
                                        <div class="toggleLineContainer">
                                            <span class="lineBarFirst"></span>
                                            <span class="lineBarSecond"></span>
                                        </div>
                                        <div class="filterRightLine"></div>
                                        <div class="filterLeftLine"></div>
                                    </li>
                                    <?php 
            }
            ?>

                            </ul>
                        </div>
                    </div>

                    <!-- gallery filter - tablet & phone -->
                    <div class="hidden-desktop clearfix">
                        <ul id="Ul1" class="filterstablet portfolio-filter" data-option-key="filter">
                            <li class="">
                                <div>
                                    <span class="text"><?php 
            _e('All', 'epicomedia');
            ?>
</span>
                                    <span class="icon icon-angle-down"></span>
                                </div>
                                <ul class=portfolio-filter-items">
                                    <?php 
            echo $catList;
            ?>
                                </ul>
                            </li>
                        </ul>
                    </div>

            <?php 
        }
    }
    ?>
                
            <div class="portfolio_wrap">

                <!-- gallery items  -->
                <div  class="isotope <?php 
    echo esc_attr($portfolio_hover) . ' ' . esc_attr($portfolio_hover_style);
    ?>
" data-categories="<?php 
    if ($portfolio_filter == 'all') {
        echo 'all';
    } else {
        echo implode(" ", $filters);
    }
    ?>
">
                    <div id="<?php 
    echo $portfolioLoop;
    ?>
" class="ep_lightGallery">

                        <?php 
    $paged1 = isset($_GET[$pagedNum]) ? (int) $_GET[$pagedNum] : 1;
    $queryArgs = array('post_type' => 'gallery', 'posts_per_page' => $gallery_posts_page, 'paged' => $paged1);
    if ($portfolio_filter == 'custom') {
        //Taxonomy filter
        if (count($catArr)) {
            $queryArgs['tax_query'] = array(array('taxonomy' => 'gallery_cat', 'field' => 'slug', 'terms' => $catArr));
        }
    }
    $count = 1;
    $query = new WP_Query($queryArgs);
    while ($query->have_posts()) {
        $query->the_post();
        include locate_template('templates/gallery-thumbnail.php');
        $count++;
    }
    wp_reset_postdata();
    ?>
                    </div>
                </div>
            </div>
            <?php 
    $query = new WP_Query($queryArgs);
    if ($query->have_posts()) {
        ?>

                    <!-- gallery load more button -->
                    <div class="pLoadMore <?php 
        echo esc_attr($pLoadMore);
        ?>
  clearfix">
                        <div class="container clearfix">
                            <div class="loadMore" data-id="<?php 
        echo $id;
        ?>
">
                                <span class="text load-more-text"><?php 
        _e("Load more", 'epicomedia');
        ?>
</span>
                                <span class="text loading-text"><?php 
        _e("Loading...", 'epicomedia');
        ?>
</span>
                            </div>
                        </div>
                    </div>

            <?php 
    }
    ?>

            <?php 
    wp_reset_query();
    ?>

        </div>
    </div>
    <!-- End gallery  -->

    <?php 
    return ob_get_clean();
}