echo sprintf('<style type="text/css">.fusion-portfolio-wrapper{margin: 0 %spx;}.fusion-portfolio-wrapper .fusion-col-spacing{padding:%spx;}</style>', -1 * $column_spacing, $column_spacing);
         // Page option not set, but theme option
     } else {
         if (Avada()->settings->get('portfolio_column_spacing')) {
             $custom_colulmn_spacing = TRUE;
             $column_spacing = Avada()->settings->get('portfolio_column_spacing') / 2;
             echo sprintf('<style type="text/css">.fusion-portfolio-wrapper{margin: 0 %spx;}.fusion-portfolio-wrapper .fusion-col-spacing{padding:%spx;}</style>', -1 * $column_spacing, $column_spacing);
         }
     }
 }
 // Loop through all the posts retrieved through our query based on chosen categories
 while ($portfolio_posts_to_display->have_posts()) {
     $portfolio_posts_to_display->the_post();
     // Set the post permalink correctly; this is important for prev/next navigation on single portfolio pages
     if ($categories_to_display_ids && !$show_all_categories) {
         $post_permalink = fusion_add_url_parameter(get_permalink(), 'portfolioID', $current_page_id);
     } else {
         $post_permalink = get_permalink();
     }
     // Include the post categories as css classes for later useage with filters
     $post_classes = '';
     $post_categories = get_the_terms($post->ID, 'portfolio_category');
     if ($post_categories) {
         foreach ($post_categories as $post_category) {
             $post_classes .= urldecode($post_category->slug) . ' ';
         }
     }
     // Add the col-spacing class if needed
     if ($custom_colulmn_spacing) {
         $post_classes .= 'fusion-col-spacing';
     }
Example #2
0
function avada_woocommerce_catalog_ordering()
{
    if (isset($_SERVER['QUERY_STRING'])) {
        parse_str($_SERVER['QUERY_STRING'], $params);
        $query_string = '?' . $_SERVER['QUERY_STRING'];
    } else {
        $query_string = '';
    }
    // replace it with theme option
    if (Avada()->settings->get('woo_items')) {
        $per_page = Avada()->settings->get('woo_items');
    } else {
        $per_page = 12;
    }
    $pob = !empty($params['product_orderby']) ? $params['product_orderby'] : 'default';
    if (!empty($params['product_order'])) {
        $po = $params['product_order'];
    } else {
        switch ($pob) {
            case 'date':
                $po = 'desc';
                break;
            case 'price':
                $po = 'asc';
                break;
            case 'popularity':
                $po = 'asc';
                break;
            case 'rating':
                $po = 'desc';
                break;
            case 'name':
                $po = 'asc';
                break;
            case 'default':
                $po = 'asc';
                break;
        }
    }
    switch ($pob) {
        case 'date':
            $order_string = __('Date', 'Avada');
            break;
        case 'price':
            $order_string = __('Price', 'Avada');
            break;
        case 'popularity':
            $order_string = __('Popularity', 'Avada');
            break;
        case 'rating':
            $order_string = __('Rating', 'Avada');
            break;
        case 'name':
            $order_string = __('Name', 'Avada');
            break;
        case 'default':
            $order_string = __('Default Order', 'Avada');
            break;
    }
    $pc = !empty($params['product_count']) ? $params['product_count'] : $per_page;
    $html = '';
    $html .= '<div class="catalog-ordering clearfix">';
    $html .= '<div class="orderby-order-container">';
    $html .= '<ul class="orderby order-dropdown">';
    $html .= '<li>';
    $html .= '<span class="current-li"><span class="current-li-content"><a aria-haspopup="true">' . __('Sort by', 'Avada') . ' <strong>' . $order_string . '</strong></a></span></span>';
    $html .= '<ul>';
    $html .= '<li class="' . ($pob == 'default' ? 'current' : '') . '"><a href="' . fusion_add_url_parameter($query_string, 'product_orderby', 'default') . '">' . __('Sort by', 'Avada') . ' <strong>' . __('Default Order', 'Avada') . '</strong></a></li>';
    $html .= '<li class="' . ($pob == 'name' ? 'current' : '') . '"><a href="' . fusion_add_url_parameter($query_string, 'product_orderby', 'name') . '">' . __('Sort by', 'Avada') . ' <strong>' . __('Name', 'Avada') . '</strong></a></li>';
    $html .= '<li class="' . ($pob == 'price' ? 'current' : '') . '"><a href="' . fusion_add_url_parameter($query_string, 'product_orderby', 'price') . '">' . __('Sort by', 'Avada') . ' <strong>' . __('Price', 'Avada') . '</strong></a></li>';
    $html .= '<li class="' . ($pob == 'date' ? 'current' : '') . '"><a href="' . fusion_add_url_parameter($query_string, 'product_orderby', 'date') . '">' . __('Sort by', 'Avada') . ' <strong>' . __('Date', 'Avada') . '</strong></a></li>';
    $html .= '<li class="' . ($pob == 'popularity' ? 'current' : '') . '"><a href="' . fusion_add_url_parameter($query_string, 'product_orderby', 'popularity') . '">' . __('Sort by', 'Avada') . ' <strong>' . __('Popularity', 'Avada') . '</strong></a></li>';
    $html .= '<li class="' . ($pob == 'rating' ? 'current' : '') . '"><a href="' . fusion_add_url_parameter($query_string, 'product_orderby', 'rating') . '">' . __('Sort by', 'Avada') . ' <strong>' . __('Rating', 'Avada') . '</strong></a></li>';
    $html .= '</ul>';
    $html .= '</li>';
    $html .= '</ul>';
    $html .= '<ul class="order">';
    if ($po == 'desc') {
        $html .= '<li class="desc"><a aria-haspopup="true" href="' . fusion_add_url_parameter($query_string, 'product_order', 'asc') . '"><i class="fusion-icon-arrow-down2 icomoon-up"></i></a></li>';
    }
    if ($po == 'asc') {
        $html .= '<li class="asc"><a aria-haspopup="true" href="' . fusion_add_url_parameter($query_string, 'product_order', 'desc') . '"><i class="fusion-icon-arrow-down2"></i></a></li>';
    }
    $html .= '</ul>';
    $html .= '</div>';
    $html .= '<ul class="sort-count order-dropdown">';
    $html .= '<li>';
    $html .= '<span class="current-li"><a aria-haspopup="true">' . __('Show', 'Avada') . ' <strong>' . $per_page . ' ' . __(' Products', 'Avada') . '</strong></a></span>';
    $html .= '<ul>';
    $html .= '<li class="' . ($pc == $per_page ? 'current' : '') . '"><a href="' . fusion_add_url_parameter($query_string, 'product_count', $per_page) . '">' . __('Show', 'Avada') . ' <strong>' . $per_page . ' ' . __('Products', 'Avada') . '</strong></a></li>';
    $html .= '<li class="' . ($pc == $per_page * 2 ? 'current' : '') . '"><a href="' . fusion_add_url_parameter($query_string, 'product_count', $per_page * 2) . '">' . __('Show', 'Avada') . ' <strong>' . $per_page * 2 . ' ' . __('Products', 'Avada') . '</strong></a></li>';
    $html .= '<li class="' . ($pc == $per_page * 3 ? 'current' : '') . '"><a href="' . fusion_add_url_parameter($query_string, 'product_count', $per_page * 3) . '">' . __('Show', 'Avada') . ' <strong>' . $per_page * 3 . ' ' . __('Products', 'Avada') . '</strong></a></li>';
    $html .= '</ul>';
    $html .= '</li>';
    $html .= '</ul>';
    $woocommerce_toggle_grid_list = Avada()->settings->get('woocommerce_toggle_grid_list');
    $product_view = 'grid';
    if (isset($_SERVER['QUERY_STRING'])) {
        parse_str($_SERVER['QUERY_STRING'], $params);
        if (isset($params['product_view'])) {
            $product_view = $params['product_view'];
        }
    }
    if ($woocommerce_toggle_grid_list) {
        $html .= '<ul class="fusion-grid-list-view">';
        if ($product_view == 'grid') {
            $html .= '<li class="fusion-grid-view-li active-view">';
        } else {
            $html .= '<li class="fusion-grid-view-li">';
        }
        $html .= '<a class="fusion-grid-view" aria-haspopup="true" href="' . fusion_add_url_parameter($query_string, 'product_view', 'grid') . '"><i class="fusion-icon-grid icomoon-grid"></i></a>';
        $html .= '</li>';
        if ($product_view == 'list') {
            $html .= '<li class="fusion-list-view-li active-view">';
        } else {
            $html .= '<li class="fusion-list-view-li">';
        }
        $html .= '<a class="fusion-list-view" aria-haspopup="true" href="' . fusion_add_url_parameter($query_string, 'product_view', 'list') . '"><i class="fusion-icon-list icomoon-list"></i></a>';
        $html .= '</li>';
        $html .= '</ul>';
    }
    $html .= '</div>';
    echo $html;
}
Example #3
0
function avada_woocommerce_catalog_ordering()
{
    if (isset($_SERVER['QUERY_STRING'])) {
        parse_str($_SERVER['QUERY_STRING'], $params);
        $query_string = '?' . $_SERVER['QUERY_STRING'];
    } else {
        $query_string = '';
    }
    // replace it with theme option
    if (Avada()->settings->get('woo_items')) {
        $per_page = Avada()->settings->get('woo_items');
    } else {
        $per_page = 12;
    }
    $pob = !empty($params['product_orderby']) ? $params['product_orderby'] : get_option('woocommerce_default_catalog_orderby');
    if (!empty($params['product_order'])) {
        $po = $params['product_order'];
    } else {
        switch ($pob) {
            case 'default':
            case 'menu_order':
                $po = 'asc';
                break;
            case 'date':
                $po = 'desc';
                break;
            case 'price':
                $po = 'asc';
                break;
            case 'price-desc':
                $po = 'desc';
                break;
            case 'popularity':
                $po = 'asc';
                break;
            case 'rating':
                $po = 'desc';
                break;
            case 'name':
                $po = 'asc';
                break;
        }
    }
    $order_string = __('Default Order', 'Avada');
    switch ($pob) {
        case 'date':
            $order_string = __('Date', 'Avada');
            break;
        case 'price':
        case 'price-desc':
            $order_string = __('Price', 'Avada');
            break;
        case 'popularity':
            $order_string = __('Popularity', 'Avada');
            break;
        case 'rating':
            $order_string = __('Rating', 'Avada');
            break;
        case 'name':
            $order_string = __('Name', 'Avada');
            break;
    }
    $pc = !empty($params['product_count']) ? $params['product_count'] : $per_page;
    ?>

	<div class="catalog-ordering clearfix">
		<div class="orderby-order-container">
			<ul class="orderby order-dropdown">
				<li>
					<span class="current-li">
						<span class="current-li-content">
							<a aria-haspopup="true"><?php 
    printf(esc_html__('Sort by %s', 'Avada'), '<strong>' . $order_string . '</strong>');
    ?>
</a>
						</span>
					</span>
					<ul>
						<li class="<?php 
    echo $pob == 'menu_order' ? 'current' : '';
    ?>
">
							<a href="<?php 
    echo fusion_add_url_parameter($query_string, 'product_orderby', 'default');
    ?>
"><?php 
    printf(esc_html__('Sort by %s', 'Avada'), '<strong>' . esc_attr__('Default Order', 'Avada') . '</strong>');
    ?>
</a>
						</li>
						<li class="<?php 
    echo $pob == 'name' ? 'current' : '';
    ?>
">
							<a href="<?php 
    echo fusion_add_url_parameter($query_string, 'product_orderby', 'name');
    ?>
"><?php 
    printf(esc_html__('Sort by %s', 'Avada'), '<strong>' . esc_attr__('Name', 'Avada') . '</strong>');
    ?>
</a>
						</li>
						<li class="<?php 
    echo $pob == 'price' || $pob == 'price-desc' ? 'current' : '';
    ?>
">
							<a href="<?php 
    echo fusion_add_url_parameter($query_string, 'product_orderby', 'price');
    ?>
"><?php 
    printf(esc_html__('Sort by %s', 'Avada'), '<strong>' . esc_attr__('Price', 'Avada') . '</strong>');
    ?>
</a>
						</li>
						<li class="<?php 
    echo $pob == 'date' ? 'current' : '';
    ?>
">
							<a href="<?php 
    echo fusion_add_url_parameter($query_string, 'product_orderby', 'date');
    ?>
"><?php 
    printf(esc_html__('Sort by %s', 'Avada'), '<strong>' . esc_attr__('Date', 'Avada') . '</strong>');
    ?>
</a>
						</li>
						<li class="<?php 
    echo $pob == 'popularity' ? 'current' : '';
    ?>
">
							<a href="<?php 
    echo fusion_add_url_parameter($query_string, 'product_orderby', 'popularity');
    ?>
"><?php 
    printf(esc_html__('Sort by %s', 'Avada'), '<strong>' . esc_attr__('Popularity', 'Avada') . '</strong>');
    ?>
</a>
						</li>
						<?php 
    if ('no' !== get_option('woocommerce_enable_review_rating')) {
        ?>
							<li class="<?php 
        echo $pob == 'rating' ? 'current' : '';
        ?>
">
								<a href="<?php 
        echo fusion_add_url_parameter($query_string, 'product_orderby', 'rating');
        ?>
"><?php 
        printf(esc_html__('Sort by %s', 'Avada'), '<strong>' . esc_attr__('Rating', 'Avada') . '</strong>');
        ?>
</a>
							</li>
						<?php 
    }
    ?>
					</ul>
				</li>
			</ul>

			<ul class="order">
				<?php 
    if (isset($po)) {
        ?>
					<?php 
        if ($po == 'desc') {
            ?>
						<li class="desc"><a aria-haspopup="true" href="<?php 
            echo fusion_add_url_parameter($query_string, 'product_order', 'asc');
            ?>
"><i class="fusion-icon-arrow-down2 icomoon-up"></i></a></li>
					<?php 
        } else {
            ?>
						<li class="asc"><a aria-haspopup="true" href="<?php 
            echo fusion_add_url_parameter($query_string, 'product_order', 'desc');
            ?>
"><i class="fusion-icon-arrow-down2"></i></a></li>
					<?php 
        }
        ?>
				<?php 
    }
    ?>
			</ul>
		</div>

		<ul class="sort-count order-dropdown">
			<li>
				<span class="current-li"><a aria-haspopup="true"><?php 
    printf(__('Show <strong>%s Products</strong>', 'Avada'), $per_page);
    ?>
</a></span>
				<ul>
					<li class="<?php 
    echo $pc == $per_page ? 'current' : '';
    ?>
">
						<a href="<?php 
    echo fusion_add_url_parameter($query_string, 'product_count', $per_page);
    ?>
"><?php 
    printf(__('Show <strong>%s Products</strong>', 'Avada'), $per_page);
    ?>
</a>
					</li>
					<li class="<?php 
    echo $pc == $per_page * 2 ? 'current' : '';
    ?>
">
						<a href="<?php 
    echo fusion_add_url_parameter($query_string, 'product_count', $per_page * 2);
    ?>
"><?php 
    printf(__('Show <strong>%s Products</strong>', 'Avada'), $per_page * 2);
    ?>
</a>
					</li>
					<li class="<?php 
    echo $pc == $per_page * 3 ? 'current' : '';
    ?>
">
						<a href="<?php 
    echo fusion_add_url_parameter($query_string, 'product_count', $per_page * 3);
    ?>
"><?php 
    printf(__('Show <strong>%s Products</strong>', 'Avada'), $per_page * 3);
    ?>
</a>
					</li>
				</ul>
			</li>
		</ul>

		<?php 
    $woocommerce_toggle_grid_list = Avada()->settings->get('woocommerce_toggle_grid_list');
    ?>
		<?php 
    $product_view = 'grid';
    ?>
		<?php 
    if (isset($_SERVER['QUERY_STRING'])) {
        ?>
			<?php 
        parse_str($_SERVER['QUERY_STRING'], $params);
        ?>
			<?php 
        if (isset($params['product_view'])) {
            ?>
				<?php 
            $product_view = $params['product_view'];
            ?>
			<?php 
        }
        ?>
		<?php 
    }
    ?>

		<?php 
    if ($woocommerce_toggle_grid_list) {
        ?>
			<ul class="fusion-grid-list-view">
				<li class="fusion-grid-view-li<?php 
        echo 'grid' == $product_view ? ' active-view' : '';
        ?>
">
					<a class="fusion-grid-view" aria-haspopup="true" href="<?php 
        echo fusion_add_url_parameter($query_string, 'product_view', 'grid');
        ?>
"><i class="fusion-icon-grid icomoon-grid"></i></a>
				</li>
				<li class="fusion-list-view-li<?php 
        echo 'list' == $product_view ? ' active-view' : '';
        ?>
">
					<a class="fusion-list-view" aria-haspopup="true" href="<?php 
        echo fusion_add_url_parameter($query_string, 'product_view', 'list');
        ?>
"><i class="fusion-icon-list icomoon-list"></i></a>
				</li>
			</ul>
		<?php 
    }
    ?>
	</div>
	<?php 
}
    }
    ?>
			<?php 
    if ($portfolioID || $categoryID) {
        $next_post_link = fusion_next_post_link_plus(array('format' => '%link', 'link' => __('Next', 'Avada'), 'in_same_tax' => 'portfolio_category', 'in_cats' => $nav_categories, 'return' => 'href'));
    } else {
        $next_post_link = fusion_next_post_link_plus(array('format' => '%link', 'link' => __('Next', 'Avada'), 'return' => 'href'));
    }
    ?>
			<?php 
    if ($next_post_link) {
        if ($portfolioID || $categoryID) {
            if ($portfolioID) {
                $next_post_link = fusion_add_url_parameter($next_post_link, 'portfolioID', $portfolioID);
            } else {
                $next_post_link = fusion_add_url_parameter($next_post_link, 'categoryID', $categoryID);
            }
        }
        ?>
			<a href="<?php 
        echo $next_post_link;
        ?>
" class="next fusion-button button-flat button-round button-large button-default button-1" rel="next"><?php 
        _e('Next', 'Avada');
        ?>
</a>
			<?php 
    }
    ?>
		</div>
		<?php 
Example #5
0
		<?php 
    /**
     * Loop through all the posts retrieved through our query based on chosen categories
     */
    ?>
		<?php 
    while ($portfolio_posts_to_display->have_posts()) {
        $portfolio_posts_to_display->the_post();
        ?>
			<?php 
        /**
         * Set the post permalink correctly.
         * this is important for prev/next navigation on single portfolio pages
         */
        $post_permalink = !empty($categories_to_display_ids) && !$show_all_categories ? fusion_add_url_parameter(get_permalink(), 'portfolioID', $current_page_id) : get_permalink();
        ?>

			<?php 
        /**
         * Include the post categories as css classes for later useage with filters
         */
        $post_classes = '';
        $post_categories = get_the_terms($post->ID, 'portfolio_category');
        if ($post_categories) {
            foreach ($post_categories as $post_category) {
                $post_classes .= urldecode($post_category->slug) . ' ';
            }
        }
        ?>