function lip_love_it_link($post_id = null, $echo = true, $text = "", $wrap_class = "") { global $user_ID, $post; if (is_null($post_id)) { $post_id = $post->ID; } global $sf_options; $loveit_icon = ""; if (isset($sf_options['loveit_icon'])) { $loveit_icon = $sf_options['loveit_icon']; } $loveit_text = $sf_options['loveit_text']; $icon = ""; if (isset($loveit_icon) && $loveit_icon != "") { $icon = '<i class="' . $loveit_icon . '"></i>'; } else { $icon = '<svg version="1.1" class="loveit-svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="30px" height="30px" viewBox="0 0 30 30" enable-background="new 0 0 30 30" xml:space="preserve"> <g> <path fill="none" class="stroke" stroke="#252525" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" d=" M5.631,24H2.021C1.459,24,1,23.541,1,22.975V2.025C1,1.459,1.459,1,2.021,1h25.957C28.543,1,29,1.459,29,2.025v20.949 C29,23.541,28.543,24,27.979,24h-3.316"/> <path fill="#252525" class="fill" d="M19.994,22.895c-0.053-0.888-0.436-1.71-1.043-2.214C18.438,20.253,17.756,20,17.074,20 c-1.035,0-1.684,0.45-2.068,1.009C14.611,20.45,13.961,20,12.926,20c-0.682,0-1.363,0.253-1.875,0.681 c-0.609,0.504-0.992,1.326-1.045,2.214c-0.043,0.757,0.139,1.908,1.248,3.082c1.875,2.007,3.367,3.618,3.389,3.629L15.006,30 l0.361-0.395c0.012-0.011,1.504-1.622,3.381-3.629C19.857,24.803,20.037,23.651,19.994,22.895z"/> </g> </svg>'; } // retrieve the total love count for this item $love_count = lip_get_love_count($post_id); if ($text != "") { $text = ' ' . $loveit_text; } if (sf_theme_opts_name() == "sf_atelier_options") { $text = ""; } ob_start(); // our wrapper DIV echo '<div class="love-it-wrapper ' . $wrap_class . '">'; if (!lip_user_has_loved_post($user_ID, $post_id)) { echo '<a href="#" class="love-it" data-post-id="' . $post_id . '" data-user-id="' . $user_ID . '">' . $icon . '<span class="love-count"><data class="count" value="">' . $love_count . '</data>' . $text . '</span></a>'; } else { echo '<a href="#" class="love-it loved" data-post-id="' . $post_id . '" data-user-id="' . $user_ID . '">' . $icon . '<span class="love-count"><data class="count" value="">' . $love_count . '</data>' . $text . '</span></a>'; } // close our wrapper DIV echo '</div>'; if ($echo) { echo apply_filters('lip_links', ob_get_clean()); } else { return apply_filters('lip_links', ob_get_clean()); } }
function sf_woo_header_add_to_cart_fragment($fragments) { global $woocommerce, $sf_options; ob_start(); $show_cart_count = false; if (isset($sf_options['show_cart_count'])) { $show_cart_count = $sf_options['show_cart_count']; } if (sf_theme_opts_name() == "sf_atelier_options") { $cart_total = '<span class="menu-item-title">' . __("Cart", "swiftframework") . '</span>'; } else { $cart_total = WC()->cart->get_cart_total(); } $cart_count = $woocommerce->cart->cart_contents_count; $cart_count_text = sf_product_items_text($cart_count); $cart_count_text_alt = sf_product_items_text($cart_count, true); $view_cart_icon = apply_filters('sf_view_cart_icon', '<i class="ss-view"></i>'); $checkout_icon = apply_filters('sf_checkout_icon', '<i class="ss-creditcard"></i>'); $go_to_shop_icon = apply_filters('sf_go_to_shop_icon', '<i class="ss-cart"></i>'); $extra_class = ""; if ($cart_count != "0") { $extra_class .= "cart-not-empty "; } ?> <li class="parent shopping-bag-item <?php echo $extra_class; ?> "> <?php if ($show_cart_count) { ?> <a class="cart-contents" href="<?php echo esc_url($woocommerce->cart->get_cart_url()); ?> " title="<?php _e('View your shopping cart', 'swiftframework'); ?> "> <?php echo apply_filters('sf_header_cart_icon', '<i class="ss-cart"></i>'); echo $cart_total; ?> <span class="num-items cart-count-enabled"><?php echo $cart_count_text_alt; ?> </span></a> <?php } else { ?> <a class="cart-contents" href="<?php echo esc_url($woocommerce->cart->get_cart_url()); ?> " title="<?php _e('View your shopping cart', 'swiftframework'); ?> "><?php echo apply_filters('sf_header_cart_icon', '<i class="ss-cart"></i>'); echo $cart_total; ?> <span class="num-items"><?php echo $cart_count_text_alt; ?> </span></a> <?php } ?> <ul class="sub-menu"> <li> <div class="shopping-bag" data-empty-bag-txt="<?php _e('Your cart is empty.', 'swiftframework'); ?> " data-singular-item-txt="<?php _e('item in the cart', 'swiftframework'); ?> " data-multiple-item-txt="<?php _e('items in the cart', 'swiftframework'); ?> "> <div class="loading-overlay"><i class="sf-icon-loader"></i></div> <?php if ($cart_count != "0") { ?> <div class="bag-header"><?php echo $cart_count_text; ?> <?php _e('in the cart', 'swiftframework'); ?> </div> <div class="bag-contents"> <?php foreach (WC()->cart->get_cart() as $cart_item_key => $cart_item) { ?> <?php $_product = apply_filters('woocommerce_cart_item_product', $cart_item['data'], $cart_item, $cart_item_key); $product_title = $_product->get_title(); $price = apply_filters('woocommerce_cart_item_price', $woocommerce->cart->get_product_price($_product), $cart_item, $cart_item_key); ?> <?php $variation_id_class = ''; if ($cart_item['variation_id'] > 0) { $variation_id_class = ' product-var-id-' . $cart_item['variation_id']; } if ($_product && $_product->exists() && $cart_item['quantity'] > 0 && apply_filters('woocommerce_cart_item_visible', true, $cart_item, $cart_item_key)) { ?> <div class="bag-product clearfix product-id-<?php echo $cart_item['product_id']; echo $variation_id_class; ?> "> <figure><a class="bag-product-img" href="<?php echo get_permalink($cart_item['product_id']); ?> "><?php echo $_product->get_image(); ?> </a> </figure> <div class="bag-product-details"> <div class="bag-product-title"> <a href="<?php echo get_permalink($cart_item['product_id']); ?> "> <?php echo apply_filters('woocommerce_cart_widget_product_title', $product_title, $_product); ?> </a> </div> <div class="bag-product-price"><?php _e("Unit Price:", "swiftframework"); ?> <?php echo $price; ?> </div> <div class="bag-product-quantity"><?php _e('Quantity:', 'swiftframework'); ?> <?php echo $cart_item['quantity']; ?> </div> </div> <a href="#" class="remove-product remove" data-ajaxurl="<?php echo admin_url('admin-ajax.php'); ?> " data-product-id="<?php echo $cart_item['product_id']; ?> " data-variation-id="<?php echo $cart_item['variation_id']; ?> " data-product-qty="<?php echo $cart_item['quantity']; ?> " title="<?php echo __('Remove this item', 'swiftframework'); ?> ">×</a> </div> <?php } ?> <?php } ?> </div> <?php if (sf_theme_opts_name() == "sf_atelier_options") { ?> <div class="bag-total"> <?php if (class_exists('Woocommerce_German_Market')) { ?> <span class="total-title"><?php _e("Total incl. tax", "swiftframework"); ?> </span> <?php } else { ?> <span class="total-title"><?php _e("Total", "swiftframework"); ?> </span> <?php } ?> <span class="total-amount"><?php echo WC()->cart->get_cart_total(); ?> </span> </div> <?php } ?> <div class="bag-buttons"> <a class="sf-button standard sf-icon-reveal bag-button" href="<?php echo esc_url($woocommerce->cart->get_cart_url()); ?> "> <?php echo $view_cart_icon; ?> <span class="text"><?php _e('View cart', 'swiftframework'); ?> </span> </a> <a class="sf-button standard sf-icon-reveal checkout-button" href="<?php echo esc_url($woocommerce->cart->get_checkout_url()); ?> "> <?php echo $checkout_icon; ?> <span class="text"><?php _e('Proceed to checkout', 'swiftframework'); ?> </span> </a> </div> <?php } else { ?> <div class="bag-empty"><?php _e('Your cart is empty.', 'swiftframework'); ?> </div> <?php } ?> </div> </li> </ul> </li> <?php $fragments['.shopping-bag-item'] = ob_get_clean(); return $fragments; }
function sf_product_items($atts) { extract(shortcode_atts(array('title' => '', 'asset_type' => '', 'category' => '', 'products' => '', 'display_layout' => '', 'display_type' => '', 'carousel' => '', 'multi_masonry' => '', 'fullwidth' => '', 'gutters' => '', 'columns' => '', 'item_count' => '', 'order_by' => '', 'order' => '', 'button_enabled' => '', 'width' => ''), $atts)); global $woocommerce, $woocommerce_loop, $sf_sidebar_config, $sf_carouselID, $sf_options, $sf_product_multimasonry, $sf_product_display_layout; if ($sf_carouselID == "") { $sf_carouselID = 1; } else { $sf_carouselID++; } if (is_singular('portfolio')) { $sf_sidebar_config = "no-sidebars"; } $list_class = ""; $product_display_type = $sf_options['product_display_type']; if ($display_type != "") { $product_display_type = $display_type; } if ($fullwidth == "yes") { $list_class .= 'products-full-width '; } if ($gutters == "no" || $product_display_type == "gallery-bordered") { $list_class .= 'no-gutters '; } if ($multi_masonry == "yes" && $product_display_type != "preview-slider" && $asset_type != "categories") { $carousel = "no"; $list_class .= 'multi-masonry-items '; $sf_product_multimasonry = true; } else { $sf_product_multimasonry = false; } if ($display_layout != '') { $sf_product_display_layout = $display_layout; } if ($carousel == "no" && $multi_masonry == "no") { $list_class .= 'product-grid '; } $list_class .= 'product-type-' . $product_display_type . ' '; $woocommerce_loop['style-override'] = $product_display_type; $args = array(); $sf_prev_icon = apply_filters('sf_carousel_prev_icon', '<i class="ss-navigateleft"></i>'); $sf_next_icon = apply_filters('sf_carousel_next_icon', '<i class="ss-navigateright"></i>'); // CATEGORY ASSET OUTPUT if ($asset_type == "categories") { ob_start(); $hide_empty = 1; $category_id = ''; $ids = array(); if ($category != "") { $category = str_replace("0,", "", $category); $categories = explode(',', $category); foreach ($categories as $term) { $category_term = get_term_by('slug', $term, 'product_cat'); $category_id = $category_term->term_id; array_push($ids, $category_id); } } $args = array('hide_empty' => $hide_empty, 'pad_counts' => true, 'include' => $ids); $product_categories = get_terms('product_cat', $args); if ($hide_empty) { foreach ($product_categories as $key => $category) { if ($category->count == 0) { unset($product_categories[$key]); } } } if ($item_count) { $product_categories = array_slice($product_categories, 0, $item_count); } ob_start(); if ($product_categories) { if ($carousel == "yes") { ?> <div class="product-carousel carousel-wrap <?php echo $list_class; ?> "> <ul class="products list-<?php echo $asset_type; ?> carousel-items gutters" id="carousel-<?php echo $sf_carouselID; ?> " data-columns="<?php echo $columns; ?> "> <?php foreach ($product_categories as $category) { wc_get_template('content-product_cat.php', array('category' => $category)); } ?> </ul> <?php if (sf_theme_opts_name() != "sf_atelier_options") { ?> <a href="#" class="carousel-prev"><?php echo $sf_prev_icon; ?> </a> <a href="#" class="carousel-next"><?php echo $sf_next_icon; ?> </a> <?php } ?> </div> <?php } else { ?> <ul class="products list-<?php echo $asset_type; ?> row <?php echo $list_class; ?> "> <?php foreach ($product_categories as $category) { wc_get_template('content-product_cat.php', array('category' => $category)); } ?> </ul> <?php } } woocommerce_reset_loop(); $product_list_output = ob_get_contents(); ob_end_clean(); wp_reset_query(); wp_reset_postdata(); return $product_list_output; } // ARRAY ARGUMENTS if ($asset_type == "latest-products") { $args = array('post_type' => 'product', 'post_status' => 'publish', 'product_cat' => $category, 'ignore_sticky_posts' => 1, 'posts_per_page' => $item_count, 'orderby' => $order_by, 'order' => $order); $args['meta_query'] = array(); $args['meta_query'][] = $woocommerce->query->stock_status_meta_query(); $args['meta_query'][] = $woocommerce->query->visibility_meta_query(); } else { if ($asset_type == "featured-products") { $args = array('post_type' => 'product', 'post_status' => 'publish', 'product_cat' => $category, 'ignore_sticky_posts' => 1, 'meta_key' => '_featured', 'meta_value' => 'yes', 'posts_per_page' => $item_count, 'orderby' => $order_by, 'order' => $order); } else { if ($asset_type == "top-rated") { add_filter('posts_clauses', array($woocommerce->query, 'order_by_rating_post_clauses')); $args = array('post_type' => 'product', 'post_status' => 'publish', 'product_cat' => $category, 'ignore_sticky_posts' => 1, 'posts_per_page' => $item_count, 'orderby' => $order_by, 'order' => $order); $args['meta_query'] = $woocommerce->query->get_meta_query(); } else { if ($asset_type == "recently-viewed") { // Get recently viewed product cookies data $viewed_products = !empty($_COOKIE['woocommerce_recently_viewed']) ? (array) explode('|', $_COOKIE['woocommerce_recently_viewed']) : array(); $viewed_products = array_filter(array_map('absint', $viewed_products)); // If no data, quit if (empty($viewed_products)) { return '<p class="no-products">' . __("You haven't viewed any products yet.", "swiftframework") . '</p>'; } // Create query arguments array $args = array('post_type' => 'product', 'post_status' => 'publish', 'product_cat' => $category, 'ignore_sticky_posts' => 1, 'posts_per_page' => $item_count, 'no_found_rows' => 1, 'post__in' => $viewed_products, 'orderby' => $order_by, 'order' => $order); // Add meta_query to query args //$args['meta_query'] = array(); // Check products stock status //$args['meta_query'][] = $woocommerce->query->stock_status_meta_query(); } else { if ($asset_type == "sale-products") { // Get products on sale $product_ids_on_sale = wc_get_product_ids_on_sale(); $meta_query = array(); $meta_query[] = WC()->query->visibility_meta_query(); $meta_query[] = WC()->query->stock_status_meta_query(); $meta_query = array_filter($meta_query); $args = array('product_cat' => $category, 'posts_per_page' => $item_count, 'no_found_rows' => 1, 'post_status' => 'publish', 'post_type' => 'product', 'meta_query' => $meta_query, 'orderby' => $order_by, 'order' => $order, 'post__in' => array_merge(array(0), $product_ids_on_sale)); } else { if ($asset_type == "selected-products") { $meta_query = array(); $meta_query[] = WC()->query->visibility_meta_query(); $meta_query[] = WC()->query->stock_status_meta_query(); $meta_query = array_filter($meta_query); $product_ids = explode(',', $products); $args = array('posts_per_page' => -1, 'no_found_rows' => 1, 'post_status' => 'publish', 'post_type' => 'product', 'meta_query' => $meta_query, 'orderby' => $order_by, 'order' => $order, 'post__in' => array_merge(array(0), $product_ids)); } else { $args = array('post_type' => 'product', 'post_status' => 'publish', 'product_cat' => $category, 'ignore_sticky_posts' => 1, 'posts_per_page' => $item_count, 'meta_key' => 'total_sales', 'orderby' => 'meta_value_num', 'meta_query' => array(array('key' => '_visibility', 'value' => array('catalog', 'visible'), 'compare' => 'IN'))); $args['meta_query'] = array(); $args['meta_query'][] = $woocommerce->query->stock_status_meta_query(); $args['meta_query'][] = $woocommerce->query->visibility_meta_query(); } } } } } } ob_start(); // OUTPUT PRODUCTS $products = new WP_Query($args); // Set Columns $woocommerce_loop['columns'] = apply_filters('loop_shop_columns', intval($columns)); if ($products->have_posts()) { ?> <?php if ($carousel == "yes") { ?> <div class="product-carousel carousel-wrap <?php echo $list_class; ?> "> <ul class="products list-<?php echo $asset_type; ?> carousel-items gutters" id="carousel-<?php echo $sf_carouselID; ?> " data-columns="<?php echo $columns; ?> "> <?php while ($products->have_posts()) { $products->the_post(); ?> <?php woocommerce_get_template_part('content', 'product'); ?> <?php } // end of the loop. ?> </ul> <?php if (sf_theme_opts_name() != "sf_atelier_options" && sf_theme_opts_name() != "sf_uplift_options") { ?> <a href="#" class="carousel-prev"><?php echo $sf_prev_icon; ?> </a> <a href="#" class="carousel-next"><?php echo $sf_next_icon; ?> </a> <?php } ?> </div> <?php } else { ?> <ul class="products list-<?php echo $asset_type; ?> row <?php echo $list_class; ?> " data-columns="<?php echo $columns; ?> "> <?php if ($multi_masonry == "yes") { ?> <div class="clearfix product col-sm-3 grid-sizer"></div> <?php } ?> <?php while ($products->have_posts()) { $products->the_post(); ?> <?php woocommerce_get_template_part('content', 'product'); ?> <?php } // end of the loop. ?> </ul> <?php } ?> <?php } // Get contents and then clean output $product_list_output = ob_get_contents(); ob_end_clean(); // Reset query wp_reset_query(); wp_reset_postdata(); remove_filter('posts_clauses', array($woocommerce->query, 'order_by_rating_post_clauses')); // Reset global $sf_product_display_layout = ""; return $product_list_output; }
function sf_page_heading() { global $wp_query, $post, $sf_options; $shop_page = false; $page_title = $page_subtitle = $page_title_style = $page_title_overlay_effect = $fancy_title_image_url = $article_heading_bg = $article_heading_text = $page_heading_el_class = $page_design_style = $extra_styles = $page_title_text_align = ""; $show_page_title = apply_filters('sf_page_heading_ns_pagetitle', 1); $remove_breadcrumbs = apply_filters('sf_page_heading_ns_removebreadcrumbs', 0); $breadcrumb_in_heading = 0; if (isset($sf_options['breadcrumb_in_heading'])) { $breadcrumb_in_heading = $sf_options['breadcrumb_in_heading']; } $page_title_height = 300; $page_title_style = "standard"; $next_icon = apply_filters('sf_next_icon', '<i class="ss-navigateright"></i>'); $prev_icon = apply_filters('sf_prev_icon', '<i class="ss-navigateleft"></i>'); // Shop page check if (function_exists('is_shop') && is_shop() || function_exists('is_product_category') && is_product_category()) { $shop_page = true; } // Defaults $default_show_page_heading = $sf_options['default_show_page_heading']; $pagination_style = "standard"; if (isset($sf_options['pagination_style'])) { $pagination_style = $sf_options['pagination_style']; } // Post meta if ($post && is_singular()) { $show_page_title = sf_get_post_meta($post->ID, 'sf_page_title', true); $remove_breadcrumbs = sf_get_post_meta($post->ID, 'sf_no_breadcrumbs', true); $page_title_style = sf_get_post_meta($post->ID, 'sf_page_title_style', true); $page_title = sf_get_post_meta($post->ID, 'sf_page_title_one', true); $page_subtitle = sf_get_post_meta($post->ID, 'sf_page_subtitle', true); $fancy_title_image = rwmb_meta('sf_page_title_image', 'type=image&size=full'); $page_title_text_style = sf_get_post_meta($post->ID, 'sf_page_title_text_style', true); $page_title_overlay_effect = sf_get_post_meta($post->ID, 'sf_page_title_overlay_effect', true); $page_title_text_align = sf_get_post_meta($post->ID, 'sf_page_title_text_align', true); $page_title_height = sf_get_post_meta($post->ID, 'sf_page_title_height', true); $page_heading_bg = sf_get_post_meta($post->ID, 'sf_page_title_bg_color', true); $page_heading_text = sf_get_post_meta($post->ID, 'sf_page_title_text_color', true); if ($page_heading_bg != "") { $article_heading_bg = 'style="background-color:' . $page_heading_bg . ';border-color:' . $page_heading_bg . ';"'; } if ($page_heading_text != "") { $article_heading_text = 'style="color:' . $page_heading_text . ';"'; } } if (is_singular('post')) { $fw_media_display = sf_get_post_meta($post->ID, 'sf_fw_media_display', true); $page_design_style = sf_get_post_meta($post->ID, 'sf_page_design_style', true); if ($fw_media_display == "fw-media-title") { return; } } // Portfolio category navigation $enable_category_navigation = $sf_options['enable_category_navigation']; // Woo setup if ($shop_page) { $show_page_title = $sf_options['woo_show_page_heading']; $page_title_style = $sf_options['woo_page_heading_style']; $fancy_title_image = $sf_options['woo_page_heading_image']; $page_title_text_style = $sf_options['woo_page_heading_text_style']; if (isset($sf_options['woo_page_heading_text_align'])) { $page_title_text_align = $sf_options['woo_page_heading_text_align']; } if (isset($fancy_title_image) && isset($fancy_title_image['url'])) { $fancy_title_image_url = $fancy_title_image['url']; } if (is_product_category()) { $category = $wp_query->get_queried_object(); $hero_id = get_woocommerce_term_meta($category->term_id, 'hero_id', true); if ($hero_id != "" && $hero_id != 0) { $fancy_title_image_url = wp_get_attachment_url($hero_id, 'full'); } } } if (function_exists('is_product') && is_product()) { $product_layout = sf_get_post_meta($post->ID, 'sf_product_layout', true); if ($product_layout == "fw-split") { return; } } // Page Title if ($show_page_title == "") { $show_page_title = $default_show_page_heading; } if ($page_title == "") { $page_title = get_the_title(); } if ($page_title_height == "") { $page_title_height = apply_filters('sf_shop_fancy_page_height', 300); } // Fancy heading image if (($page_title_style == "fancy" || $page_title_style == "fancy-tabbed") && $fancy_title_image_url == "") { foreach ($fancy_title_image as $detail_image) { if (isset($detail_image['url'])) { $fancy_title_image_url = $detail_image['url']; break; } } if (!$fancy_title_image) { $fancy_title_image = get_post_thumbnail_id(); $fancy_title_image_url = wp_get_attachment_url($fancy_title_image, 'full'); } } // Page Title Hidden if (!$show_page_title) { $page_heading_el_class = "page-heading-hidden"; } // Breadcrumb in heading if ($breadcrumb_in_heading) { $page_heading_el_class .= " page-heading-breadcrumbs"; } if ($page_title_style == "fancy-tabbed") { $page_title_text_align = "left"; } // Return if product & inner heading if (function_exists('is_product') && is_product() && sf_theme_supports('product-inner-heading') && ($page_title_style == "standard" || $page_title_style == "")) { return; } // Dont' allow fancy-tabbed on product pages if (function_exists('is_product') && is_product() && sf_theme_supports('product-inner-heading') && $page_title_style == "fancy-tabbed") { $page_title_style = "fancy"; } if ($page_title_style == "fancy" && sf_theme_opts_name() == "sf_atelier_options" && !(function_exists('is_product') && is_product())) { $extra_styles = 'height: ' . $page_title_height . 'px;'; } if (isset($sf_options['minimal_checkout'])) { if (function_exists('is_checkout') && is_checkout()) { global $woocommerce; if ($sf_options['minimal_checkout']) { ?> <div class="minimal-checkout-return container"><a href="<?php echo esc_url($woocommerce->cart->get_cart_url()); ?> "><?php _e("Return to cart", "swiftframework"); ?> </a></div> <?php } } } if (!is_home()) { ?> <?php if ($page_title_style == "fancy" || $page_title_style == "fancy-tabbed") { ?> <div class="fancy-heading-wrap <?php echo esc_attr($page_title_style); ?> -style"> <?php if ($fancy_title_image_url != "") { $bg_color_title = $bg_opacity_title = ""; if ($post) { $bg_color_title = sf_get_post_meta($post->ID, 'sf_bg_color_title', true); $bg_opacity_title = sf_get_post_meta($post->ID, 'sf_bg_opacity_title', true); } if (!$bg_color_title) { $bg_color_title = "transparent"; $bg_opacity_title = "0"; } ?> <div class="page-heading fancy-heading clearfix <?php echo esc_attr($page_title_text_style); ?> -style fancy-image <?php echo esc_attr($page_heading_el_class); ?> " style="background-image: url(<?php echo esc_url($fancy_title_image_url); ?> );<?php echo $extra_styles; ?> " data-height="<?php echo esc_attr($page_title_height); ?> "> <span class="media-overlay" style="background-color:<?php echo $bg_color_title; ?> ;opacity:<?php echo $bg_opacity_title / 100; ?> ;"></span> <?php } else { ?> <div class="page-heading fancy-heading <?php echo esc_attr($page_heading_el_class); ?> clearfix" data-height="<?php echo esc_attr($page_title_height); ?> " <?php echo $article_heading_bg; ?> > <?php } ?> <?php if ($page_title_style == "fancy" && $page_design_style == "hero-content-split") { sf_post_split_heading_buttons(); } ?> <?php if ($page_title_style == "fancy-tabbed") { ?> <div class="tabbed-heading-wrap"> <?php } ?> <div class="heading-text container" data-textalign="<?php echo esc_attr($page_title_text_align); ?> "> <?php if (sf_woocommerce_activated() && is_woocommerce()) { ?> <?php if (is_product()) { ?> <h1 class="entry-title" <?php echo $article_heading_text; ?> ><?php echo $page_title; ?> </h1> <?php } else { ?> <h1 class="entry-title" <?php echo $article_heading_text; ?> ><?php woocommerce_page_title(); ?> </h1> <?php } ?> <?php } else { ?> <h1 class="entry-title"><?php echo $page_title; ?> </h1> <?php } ?> <?php if ($page_subtitle) { ?> <h3><?php echo $page_subtitle; ?> </h3> <?php } ?> <?php if (!$remove_breadcrumbs && $breadcrumb_in_heading) { echo sf_breadcrumbs(true); } ?> <?php if (is_singular('portfolio') && !(sf_theme_opts_name() == "sf_joyn_options" && $pagination_style == "fs-arrow")) { ?> <div class="prev-item" <?php echo $article_heading_text; ?> ><?php next_post_link('%link', $prev_icon, $enable_category_navigation, '', 'portfolio-category'); ?> </div> <div class="next-item" <?php echo $article_heading_text; ?> ><?php previous_post_link('%link', $next_icon, $enable_category_navigation, '', 'portfolio-category'); ?> </div> <?php } ?> <?php if (is_singular('galleries') && !(sf_theme_opts_name() == "sf_joyn_options" && $pagination_style == "fs-arrow")) { ?> <div class="prev-item" <?php echo $article_heading_text; ?> ><?php next_post_link('%link', $prev_icon, false, '', 'gallery-category'); ?> </div> <div class="next-item" <?php echo $article_heading_text; ?> ><?php previous_post_link('%link', $next_icon, false, '', 'gallery-category'); ?> </div> <?php } ?> </div> <?php if ($page_title_style == "fancy-tabbed") { ?> </div> <?php } ?> <?php if ($page_title_overlay_effect != "" && $page_title_overlay_effect != "none") { ?> <div class="sf-canvas-effect" data-type="<?php echo esc_attr($page_title_overlay_effect); ?> "> <canvas id="page-heading-canvas" data-canvas_id="page-heading-canvas"></canvas> </div> <?php } ?> </div> </div> <?php } else { ?> <?php if ($show_page_title == 2) { ?> <div class="page-heading ph-sort clearfix" <?php echo $article_heading_bg; ?> > <?php } else { ?> <div class="page-heading <?php echo esc_attr($page_heading_el_class); ?> clearfix" <?php echo $article_heading_bg; ?> > <?php } ?> <div class="container"> <div class="heading-text"> <?php if (sf_woocommerce_activated() && is_woocommerce()) { ?> <?php if (is_product()) { ?> <h1 class="entry-title" <?php echo $article_heading_text; ?> ><?php echo $page_title; ?> </h1> <?php } else { ?> <h1 class="entry-title" <?php echo $article_heading_text; ?> ><?php woocommerce_page_title(); ?> </h1> <?php } ?> <?php } else { if (is_search()) { ?> <?php $s = get_search_query(); $allsearch = new WP_Query("s={$s}&showposts=-1"); $key = esc_html($s, 1); $count = $allsearch->post_count; wp_reset_query(); ?> <?php if ($count == 1) { ?> <?php printf(__('<h1>%1$s result for <span>%2$s</span></h1>', 'swiftframework'), $count, get_search_query()); ?> <?php } else { ?> <?php printf(__('<h1>%1$s results for <span>%2$s</span></h1>', 'swiftframework'), $count, get_search_query()); ?> <?php } ?> <?php } else { if (is_category()) { ?> <h1 <?php echo $article_heading_text; ?> ><?php single_cat_title(); ?> </h1> <?php } else { if (is_archive()) { ?> <?php /* If this is a tag archive */ if (is_tag()) { ?> <h1 <?php echo $article_heading_text; ?> ><?php _e("Posts tagged with", "swiftframework"); ?> ‘<?php single_tag_title(); ?> ’</h1> <?php /* If this is a daily archive */ } elseif (is_day()) { ?> <h1 <?php echo $article_heading_text; ?> ><?php _e("Archive for", "swiftframework"); ?> <?php the_time('F jS, Y'); ?> </h1> <?php /* If this is a monthly archive */ } elseif (is_month()) { ?> <h1 <?php echo $article_heading_text; ?> ><?php _e("Archive for", "swiftframework"); ?> <?php the_time('F, Y'); ?> </h1> <?php /* If this is a yearly archive */ } elseif (is_year()) { ?> <h1 <?php echo $article_heading_text; ?> ><?php _e("Archive for", "swiftframework"); ?> <?php the_time('Y'); ?> </h1> <?php /* If this is an author archive */ } elseif (is_author()) { ?> <?php $author = get_userdata(get_query_var('author')); ?> <?php if (class_exists('ATCF_Campaigns')) { ?> <h1 <?php echo $article_heading_text; ?> ><?php _e("Projects by", "swiftframework"); ?> <?php echo esc_attr($author->display_name); ?> </h1> <?php } else { ?> <h1 <?php echo $article_heading_text; ?> ><?php _e("Author archive for", "swiftframework"); ?> <?php echo esc_attr($author->display_name); ?> </h1> <?php } ?> <?php /* If this is a paged archive */ } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { ?> <h1 <?php echo $article_heading_text; ?> ><?php _e("Blog Archives", "swiftframework"); ?> </h1> <?php } else { ?> <h1 <?php echo $article_heading_text; ?> ><?php post_type_archive_title(); ?> </h1> <?php } ?> <?php } else { if (is_404()) { ?> <h1 class="entry-title" <?php echo $article_heading_text; ?> ><?php _e("404", "swiftframework"); ?> </h1> <?php } else { if (is_home() && get_option('page_for_posts')) { ?> <h1 class="entry-title" <?php echo $article_heading_text; ?> ><?php echo apply_filters('the_title', get_page(get_option('page_for_posts'))->post_title); ?> </h1> <?php } else { ?> <h1 class="entry-title" <?php echo $article_heading_text; ?> ><?php echo $page_title; ?> </h1> <?php } } } } } } ?> </div> <?php if (is_singular('portfolio') && !(sf_theme_opts_name() == "sf_joyn_options" && $pagination_style == "fs-arrow")) { ?> <div class="next-item" <?php echo $article_heading_text; ?> ><?php previous_post_link('%link', $next_icon, $enable_category_navigation, '', 'portfolio-category'); ?> </div> <div class="prev-item" <?php echo $article_heading_text; ?> ><?php next_post_link('%link', $prev_icon, $enable_category_navigation, '', 'portfolio-category'); ?> </div> <?php } ?> <?php if (is_singular('galleries') && !(sf_theme_opts_name() == "sf_joyn_options" && $pagination_style == "fs-arrow")) { ?> <div class="next-item" <?php echo $article_heading_text; ?> ><?php previous_post_link('%link', $next_icon, false, '', 'gallery-category'); ?> </div> <div class="prev-item" <?php echo $article_heading_text; ?> ><?php next_post_link('%link', $prev_icon, false, '', 'gallery-category'); ?> </div> <?php } ?> <?php if (!$remove_breadcrumbs && $breadcrumb_in_heading) { echo sf_breadcrumbs(true); } ?> <?php if ($shop_page && sf_theme_supports('page-heading-woocommerce')) { woocommerce_catalog_ordering(); woocommerce_result_count(); } ?> </div> </div> <?php } } }
function widget($args, $instance) { global $post, $sf_options; extract($args); $remove_dates = $sf_options['remove_dates']; // Widget Options $title = apply_filters('widget_title', $instance['title']); // Title $number = $instance['number']; // Number of posts to show $category = $instance['category']; // Category to show if ($category == "All") { $category = "all"; } if ($category == "all") { $category = ''; } $category_slug = str_replace('_', '-', $category); echo $before_widget; if ($title) { echo $before_title . $title . $after_title; } $video_icon = apply_filters('sf_video_icon', '<i class="ss-video"></i>'); $audio_icon = apply_filters('sf_audio_icon', '<i class="ss-music"></i>'); $picture_icon = apply_filters('sf_picture_icon', '<i class="ss-picture"></i>'); $post_icon = apply_filters('sf_post_icon', '<i class="ss-file"></i>'); $recent_posts = new WP_Query(array('post_type' => 'post', 'posts_per_page' => $number, 'category_name' => $category_slug)); $thumb_width = apply_filters('sf_widget_posts_thumb_width', 94); $thumb_height = apply_filters('sf_widget_posts_thumb_height', 75); if ($recent_posts->have_posts()) { ?> <ul class="recent-posts-list"> <?php while ($recent_posts->have_posts()) { $recent_posts->the_post(); $thumb_type = sf_get_post_meta($post->ID, 'sf_thumbnail_type', true); $post_title = get_the_title(); $post_author = get_the_author_link(); $post_date = get_the_date(); $post_categories = get_the_category_list(); $post_comments = get_comments_number(); $post_permalink = get_permalink(); $thumb_image = get_post_thumbnail_id(); $thumb_img_url = wp_get_attachment_url($thumb_image, 'widget-image'); $image = sf_aq_resize($thumb_img_url, $thumb_width, $thumb_height, true, false); $image_alt = esc_attr(sf_get_post_meta($thumb_image, '_wp_attachment_image_alt', true)); ?> <?php if ($image) { ?> <li class="has-image"> <a href="<?php echo esc_url($post_permalink); ?> " class="recent-post-image"> <img src="<?php echo esc_url($image[0]); ?> " width="<?php echo esc_attr($image[1]); ?> " height="<?php echo esc_attr($image[2]); ?> " alt="<?php echo esc_attr($image_alt); ?> "/> </a> <?php } else { ?> <li> <?php } ?> <div class="recent-post-details"> <a class="recent-post-title" href="<?php echo esc_url($post_permalink); ?> " title="<?php echo esc_attr($post_title); ?> "><?php echo esc_attr($post_title); ?> </a> <?php if (sf_theme_opts_name() == "sf_uplift_options") { echo '<div class="excerpt">' . sf_excerpt(20) . '</div>'; if (!$remove_dates) { echo '<div class="blog-item-details">' . sprintf(__('<time datetime="%1$s">%2$s</time>', 'swiftframework'), get_the_date('Y-m-d'), get_the_date()) . '</div>'; } } else { ?> <span><?php printf(__('By %1$s on %2$s', 'swiftframework'), $post_author, $post_date); ?> </span> <div class="comments-likes"> <?php if (comments_open()) { ?> <div class="comments-wrapper"> <a href="<?php echo esc_url($post_permalink); ?> #comment-area"><?php echo apply_filters('sf_comments_icon', '<i class="ss-chat"></i>'); ?> <span><?php echo esc_attr($post_comments); ?> </span></a> </div> <?php } ?> <?php if (function_exists('lip_love_it_link')) { echo lip_love_it_link(get_the_ID(), false); } ?> </div> <?php } ?> </div> </li> <?php } wp_reset_postdata(); ?> </ul> <?php } ?> <?php echo $after_widget; }
function sf_post_pagination() { global $sf_options, $sf_sidebar_config; $blog_page = __($sf_options['blog_page'], 'swiftframework'); $single_author = $sf_options['single_author']; $remove_dates = $sf_options['remove_dates']; $pagination_style = "standard"; if (isset($sf_options['pagination_style'])) { $pagination_style = $sf_options['pagination_style']; } $prev_post = get_next_post(); $next_post = get_previous_post(); $has_both = false; if (sf_theme_opts_name() == "sf_joyn_options" && $pagination_style == "fs-arrow") { return; } if (!empty($next_post) && !empty($prev_post)) { $has_both = true; } ?> <?php if (!empty($next_post) || !empty($prev_post)) { ?> <?php if ($has_both) { ?> <div class="post-pagination prev-next clearfix"> <?php } else { ?> <div class="post-pagination clearfix"> <?php } ?> <?php if (!empty($prev_post)) { $author_id = $prev_post->post_author; $author_name = get_the_author_meta('display_name', $author_id); $author_url = get_author_posts_url($author_id); $post_date = get_the_date(); $post_date_str = get_the_date('Y-m-d'); $post_categories = get_the_category_list(', ', '', $prev_post->ID); ?> <a class="prev-article col-sm-4" href="<?php echo get_permalink($prev_post->ID); ?> "> <h4><?php _e("Newer", 'swiftframework'); ?> </h4> <h3><?php echo esc_attr($prev_post->post_title); ?> </h3> </a> <?php } else { ?> <div class="pagination-spacer col-sm-4"></div> <?php } ?> <?php if ($blog_page != "") { ?> <div class="blog-button col-sm-4"> <a class="sf-button medium rounded black bordered" href="<?php echo get_permalink($blog_page); ?> "> <span class="text"><?php _e("View all posts", "swiftframework"); ?> </span> </a> </div> <?php } ?> <?php if (!empty($next_post)) { $author_id = $next_post->post_author; $author_name = get_the_author_meta('display_name', $author_id); $author_url = get_author_posts_url($author_id); $post_date = get_the_date(); $post_date_str = get_the_date('Y-m-d'); $post_categories = get_the_category_list(', ', '', $next_post->ID); ?> <a class="next-article col-sm-4" href="<?php echo get_permalink($next_post->ID); ?> "> <h4><?php _e("Older", 'swiftframework'); ?> </h4> <h3><?php echo esc_attr($next_post->post_title); ?> </h3> </a> <?php } ?> </div> <?php } ?> <?php }
function sf_get_recent_post_item($post, $display_type = "bold", $excerpt_length = 20, $item_class = "") { $recent_post = $recent_post_figure = $link_config = $item_icon = ""; $thumb_type = sf_get_post_meta($post->ID, 'sf_thumbnail_type', true); $thumb_image = rwmb_meta('sf_thumbnail_image', 'type=image&size=full'); $thumb_video = sf_get_post_meta($post->ID, 'sf_thumbnail_video_url', true); $thumb_gallery = rwmb_meta('sf_thumbnail_gallery', 'type=image&size=thumb-image'); foreach ($thumb_image as $detail_image) { $thumb_img_url = $detail_image['url']; break; } if (!$thumb_image) { $thumb_image = get_post_thumbnail_id(); $thumb_img_url = wp_get_attachment_url($thumb_image, 'full'); } // POST META global $sf_options; $single_author = $sf_options['single_author']; $remove_dates = $sf_options['remove_dates']; $post_links_match_thumb = false; if (isset($sf_options['post_links_match_thumb'])) { $post_links_match_thumb = $sf_options['post_links_match_thumb']; } $post_author = get_the_author_link(); $post_date = get_the_date(); $post_date_str = get_the_date('Y-m-d'); $item_title = get_the_title(); $post_permalink = get_permalink(); $post_comments = get_comments_number(); $custom_excerpt = sf_get_post_meta($post->ID, 'sf_custom_excerpt', true); $post_excerpt = ''; if ($custom_excerpt != '') { $post_excerpt = sf_custom_excerpt($custom_excerpt, $excerpt_length); } else { $post_excerpt = sf_excerpt($excerpt_length); } $post_permalink_config = 'href="' . $post_permalink . '" class="link-to-post"'; if ($post_links_match_thumb) { $link_config = sf_post_item_link(); $post_permalink_config = $link_config['config']; } $thumb_width = apply_filters('sf_recent_post_item_thumb_width', 360); $thumb_height = apply_filters('sf_recent_post_item_thumb_height', 270); if ($display_type == "standard-row") { $thumb_width = apply_filters('sf_recent_post_item_thumb_width', 400); $thumb_height = apply_filters('sf_recent_post_item_thumb_height', 300); } // MEDIA CONFIG $thumb_link_type = sf_get_post_meta($post->ID, 'sf_thumbnail_link_type', true); $thumb_link_url = sf_get_post_meta($post->ID, 'sf_thumbnail_link_url', true); $thumb_lightbox_thumb = rwmb_meta('sf_thumbnail_image', 'type=image&size=large'); $thumb_lightbox_image = rwmb_meta('sf_thumbnail_link_image', 'type=image&size=large'); $thumb_lightbox_video_url = sf_get_post_meta($post->ID, 'sf_thumbnail_link_video_url', true); $thumb_lightbox_video_url = sf_get_embed_src($thumb_lightbox_video_url); $thumb_lightbox_img_url = wp_get_attachment_url($thumb_lightbox_image, 'full'); // LINK CONFIG if ($thumb_link_type == "link_to_url") { $link_config = 'href="' . $thumb_link_url . '" class="link-to-url"'; $item_icon = apply_filters('sf_post_link_icon', "ss-link"); } else { if ($thumb_link_type == "link_to_url_nw") { $link_config = 'href="' . $thumb_link_url . '" class="link-to-url" target="_blank"'; $item_icon = apply_filters('sf_post_link_icon', "ss-link"); } else { if ($thumb_link_type == "lightbox_thumb") { $lightbox_id = rand(); if ($thumb_img_url != "") { $link_config = 'href="' . $thumb_img_url . '" class="lightbox" data-rel="ilightbox[' . $lightbox_id . ']"'; } $item_icon = apply_filters('sf_post_lightbox_icon', "ss-view"); } else { if ($thumb_link_type == "lightbox_image") { $lightbox_image_url = ''; foreach ($thumb_lightbox_image as $image) { $lightbox_image_url = $image['full_url']; } $lightbox_id = rand(); if ($lightbox_image_url != "") { $link_config = 'href="' . $lightbox_image_url . '" class="lightbox" data-rel="ilightbox[' . $lightbox_id . ']"'; } $item_icon = apply_filters('sf_post_lightbox_icon', "ss-view"); } else { if ($thumb_link_type == "lightbox_video") { $link_config = 'data-video="' . $thumb_lightbox_video_url . '" href="#" class="fw-video-link"'; $item_icon = apply_filters('sf_post_video_icon', "ss-video"); } else { $link_config = 'href="' . $post_permalink . '" class="link-to-post"'; $item_icon = apply_filters('sf_post_standard_icon', "ss-navigateright"); } } } } } if ($thumb_type == "none") { $recent_post .= '<div itemscope class="recent-post no-thumb ' . $item_class . ' clearfix">'; } else { $recent_post .= '<div itemscope class="recent-post has-thumb ' . $item_class . ' clearfix">'; } $recent_post_figure .= '<div class="figure-wrap">'; $recent_post_figure .= apply_filters('sf_before_recent_post_thumb', ''); $recent_post_figure .= '<figure class="animated-overlay overlay-alt">'; if ($thumb_type == "video") { $video = sf_video_embed($thumb_video, 400, 225); $recent_post_figure .= '<div class="video-thumb">' . $video . '</div>'; } else { if ($thumb_type == "slider") { $recent_post_figure .= '<div class="flexslider thumb-slider"><ul class="slides">'; foreach ($thumb_gallery as $image) { $alt = $image['alt']; if (!$alt) { $alt = $image['title']; } $recent_post_figure .= "<li><a " . $link_config . "><img src='{$image['url']}' width='{$image['width']}' height='{$image['height']}' alt='{$alt}' /></a></li>"; } $recent_post_figure .= '</ul></div>'; } else { if ($thumb_img_url == "" && $thumb_type != "none") { $thumb_img_url = "default"; } $image = sf_aq_resize($thumb_img_url, $thumb_width, $thumb_height, true, false); if ($image) { $recent_post_figure .= '<img itemprop="image" src="' . $image[0] . '" width="' . $image[1] . '" height="' . $image[2] . '" alt="' . $item_title . '" />'; $recent_post_figure .= '<a ' . $link_config . '></a>'; $recent_post_figure .= '<div class="figcaption-wrap"></div>'; if ($display_type == "showcase") { $recent_post_figure .= '<figcaption><div class="thumb-info">'; $recent_post_figure .= '<h5><span class="post-date updated">' . $post_date . '</span></h5>'; $recent_post_figure .= '<h4>' . $item_title . '</h4>'; $recent_post_figure .= '</div></figcaption>'; } else { $recent_post_figure .= '<figcaption><div class="thumb-info thumb-info-alt">'; $recent_post_figure .= '<i class="' . $item_icon . '"></i>'; $recent_post_figure .= '</div></figcaption>'; } } } } $recent_post_figure .= '</figure>'; $recent_post_figure .= '</div>'; if ($display_type == "bold") { $recent_post .= $recent_post_figure; $recent_post .= '<div class="details-wrap">'; if ($thumb_type == "none") { $recent_post .= '<h2><a ' . $post_permalink_config . '>' . $item_title . '</a></h2>'; } else { $recent_post .= '<h3><a ' . $post_permalink_config . '>' . $item_title . '</a></h3>'; } $recent_post .= sf_get_post_details($post->ID, true); $recent_post .= '</div>'; } else { if ($display_type == "list") { $recent_post .= '<a class="list-post-link" href="' . $post_permalink . '"></a>'; if ($image) { $recent_post_figure .= '<figure class="animated-overlay">'; $recent_post_figure .= '<img itemprop="image" src="' . $image[0] . '" width="' . $image[1] . '" height="' . $image[2] . '" alt="' . $item_title . '" />'; $recent_post_figure .= '<a ' . $link_config . '></a>'; $recent_post_figure .= '<div class="figcaption-wrap"></div>'; $recent_post_figure .= '<figcaption><div class="thumb-info thumb-info-alt">'; $recent_post_figure .= '<i class="' . $item_icon . '"></i>'; $recent_post_figure .= '</div></figcaption>'; $recent_post_figure .= '</figure>'; } $recent_post .= '<div class="details-wrap">'; $recent_post .= '<h4>' . $item_title . '</h4>'; $recent_post .= '<div class="post-item-details">'; $recent_post .= '<span class="post-date updated">' . $post_date . '</span>'; $recent_post .= '</div>'; $recent_post .= '</div>'; } else { if ($display_type == "bright") { $recent_post .= '<div class="details-wrap">'; $recent_post .= '<div class="author-avatar">' . get_avatar(get_the_author_meta('ID'), '140') . '</div>'; $recent_post .= '<h6 class="post-item-author"><span class="author">' . sprintf('<a href="%2$s" rel="author" itemprop="author">%1$s</a>', $post_author, get_author_posts_url(get_the_author_meta('ID'))) . '</span></h6>'; $recent_post .= '<h2><a ' . $post_permalink_config . '>' . $item_title . '</a></h2>'; $recent_post .= '<div class="post-item-details">'; $recent_post .= '<span class="post-date updated">' . $post_date . '</span>'; $recent_post .= '</div>'; $recent_post .= '</div>'; } else { if ($display_type == "bold") { $recent_post .= $recent_post_figure; $recent_post .= '<div class="details-wrap">'; if ($thumb_type == "none") { $recent_post .= '<h2><a ' . $post_permalink_config . '>' . $item_title . '</a></h2>'; } else { $recent_post .= '<h3><a ' . $post_permalink_config . '>' . $item_title . '</a></h3>'; } $recent_post = sf_get_post_details($post->ID, true); $recent_post .= '</div>'; } else { if ($display_type == "showcase") { $recent_post .= $recent_post_figure; } else { $recent_post .= $recent_post_figure; $recent_post .= '<div class="details-wrap">'; $recent_post .= '<h5><a ' . $post_permalink_config . '>' . $item_title . '</a></h5>'; $recent_post .= sf_get_post_details($post->ID, true); if ($excerpt_length != "0" && $excerpt_length != "") { $recent_post .= '<div class="excerpt">' . $post_excerpt . '</div>'; } if (sf_theme_opts_name() == "sf_atelier_options" && $display_type == "standard-row") { $recent_post .= '<a class="read-more-button" href="' . get_permalink() . '">' . __("Read more", "swiftframework") . '</a>'; } $recent_post .= '</div>'; } } } } } $recent_post .= '</div>'; return $recent_post; }
function sf_page_classes() { // Get options global $sf_options, $post, $sf_catalog_mode; $enable_responsive = $sf_options['enable_responsive']; $is_responsive = "responsive-fluid"; if (!$enable_responsive) { $is_responsive = "responsive-fixed"; } $enable_rtl = $sf_options['enable_rtl']; $design_style = sf_get_option('design_style_type', 'minimal'); $page_header_type = $page_slider = $page_header_alt_logo = $page_style = $page_design_style = ""; $header_layout = $sf_options['header_layout']; if (isset($_GET['header'])) { $header_layout = $_GET['header']; } $page_layout = $sf_options['page_layout']; $enable_page_shadow = $sf_options['enable_page_shadow']; $enable_page_transitions = $sf_options['enable_page_transitions']; $page_transition = $sf_options['page_transition']; $enable_header_shadow = false; $mobile_two_click = false; if (isset($sf_options['enable_header_shadow'])) { $enable_header_shadow = $sf_options['enable_header_shadow']; } $product_image_shadows = true; if (isset($sf_options['product_image_shadows'])) { $product_image_shadows = $sf_options['product_image_shadows']; } if (isset($sf_options['enable_mobile_two_click'])) { $mobile_two_click = $sf_options['enable_mobile_two_click']; } $enable_mini_header = $sf_options['enable_mini_header']; $enable_mini_header_resize = $sf_options['enable_mini_header_resize']; $header_search_type = $sf_options['header_search_type']; $mobile_header_layout = $sf_options['mobile_header_layout']; $mobile_header_shown = $sf_options['mobile_header_shown']; $mobile_header_sticky = $sf_options['mobile_header_sticky']; $mobile_menu_type = "slideout"; $enable_sticky_header_hide = false; $enable_newsletter_sub_bar = $enable_newsletter_sub_bar_page = false; if (isset($sf_options['mobile_menu_type'])) { $mobile_menu_type = $sf_options['mobile_menu_type']; } $enable_articleswipe = 0; if (isset($sf_options['enable_articleswipe'])) { $enable_articleswipe = $sf_options['enable_articleswipe']; } $home_preloader = false; if (isset($sf_options['home_preloader'])) { $home_preloader = $sf_options['home_preloader']; } if (isset($sf_options['enable_sticky_header_hide'])) { $enable_sticky_header_hide = $sf_options['enable_sticky_header_hide']; } if (isset($sf_options['enable_newsletter_sub_bar'])) { $enable_newsletter_sub_bar = $sf_options['enable_newsletter_sub_bar']; } if ($post && is_singular() && !is_search()) { $page_header_type = sf_get_post_meta($post->ID, 'sf_page_header_type', true); $page_header_alt_logo = sf_get_post_meta($post->ID, 'sf_page_header_alt_logo', true); $page_slider = sf_get_post_meta($post->ID, 'sf_page_slider', true); $page_design_style = sf_get_post_meta($post->ID, 'sf_page_design_style', true); $enable_newsletter_sub_bar_page = sf_get_post_meta($post->ID, 'sf_enable_newsletter_bar', true); } if (isset($sf_options['enable_newsletter_sub_bar_globally'])) { $enable_newsletter_sub_bar_page = $sf_options['enable_newsletter_sub_bar_globally']; } // Shop page check $shop_page = false; if (function_exists('is_shop') && is_shop() || function_exists('is_product_category') && is_product_category()) { $shop_page = true; } if ($shop_page) { if (isset($sf_options['woo_page_header'])) { $page_header_type = $sf_options['woo_page_header']; } } if (($page_header_type == "naked-light" || $page_header_type == "naked-dark") && ($header_layout == "header-vert" || $header_layout == "header-vert-right")) { $header_layout = apply_filters('sf_naked_default_header', "header-1"); } // Create variables $page_class = $header_wrap_class = $logo_class = $shop_icon_style = ""; // Design Style if (isset($_GET['design_style'])) { $design_style = $_GET['design_style']; } $page_class .= $design_style . "-design "; // Theme Specific if (sf_theme_opts_name() == "sf_atelier_options") { //$page_class .= 'ss-parallax-disabled '; } // Header Layout if ($page_header_type == "standard-overlay") { $page_class .= "header-overlay "; } else { if ($header_layout == "header-5") { $page_class .= "header-5-overlay "; } } if ($header_layout == "header-vert") { $page_class .= "vertical-header "; } if ($header_layout == "header-vert-right") { $page_class .= "vertical-header vertical-header-right "; } if ($header_layout == "header-3" || $header_layout == "header-4" || $header_layout == "header-5" || $header_layout == "header-split" || $header_layout == "header-4-alt") { $header_wrap_class = " full-center"; } if ($header_layout == "header-3" || $header_layout == "header-4" || $header_layout == "header-5" || $header_layout == "header-7" || $header_layout == "header-8" || $header_layout == "header-split" || $header_layout == "header-4-alt") { $header_wrap_class .= " full-header-stick"; } // Mobile Header Layout $page_class .= "mobile-header-" . $mobile_header_layout . " "; $page_class .= "mhs-" . $mobile_header_shown . " "; if ($mobile_header_sticky) { $page_class .= "mh-sticky "; } $page_class .= 'mh-' . $mobile_menu_type . ' '; // Catalog Mode if (isset($sf_options['enable_catalog_mode'])) { $enable_catalog_mode = $sf_options['enable_catalog_mode']; if (isset($_GET['catalog_mode'])) { $enable_catalog_mode = $_GET['catalog_mode']; } if ($enable_catalog_mode) { $sf_catalog_mode = true; $page_class .= "catalog-mode "; } } // Responsive class $page_class .= $is_responsive . ' '; // RTL class if (is_rtl() || $enable_rtl || isset($_GET['RTL'])) { $page_class .= 'rtl '; } // Mini header if ($enable_mini_header && !($header_layout == "header-vert" || $header_layout == "header-vert-right")) { $page_class .= "sticky-header-enabled "; if ($enable_mini_header_resize) { $page_class .= "sh-dynamic "; } if ($enable_sticky_header_hide) { $page_class .= "sh-show-hide "; } } else { $page_class .= "sticky-header-disabled "; } // Page Shadow if ($enable_page_shadow) { $page_class .= "page-shadow "; } // Mobile 2 Click if ($mobile_two_click) { $page_class .= "mobile-two-click "; } // Page Transtions if ($enable_page_transitions) { $page_class .= "page-transitions page-transition-" . $page_transition . " "; if ($page_transition == "loading-bar") { $page_class .= "loading-bar-transition "; } } // Page Style if ($page_design_style != "") { $page_class .= $page_design_style . ' '; } // Header Shadow if ($enable_header_shadow) { $page_class .= "header-shadow "; } // Product Shadow if ($product_image_shadows) { $page_class .= "product-shadows "; } // Page Header Type if ($page_header_type != "") { $page_class .= 'header-' . $page_header_type . ' '; } // Page Header Logo if ($page_header_alt_logo) { $page_class .= 'logo-alt-version '; } if (is_singular('post') && $post) { $post_header_type = sf_get_post_meta($post->ID, 'sf_page_header_type', true); $fw_media_display = sf_get_post_meta($post->ID, 'sf_fw_media_display', true); $page_title_style = sf_get_post_meta($post->ID, 'sf_page_title_style', true); if ($page_title_style == "fancy" || $fw_media_display == "fw-media-title" || $fw_media_display == "fw-media") { $page_class .= 'header-' . $post_header_type . ' '; } } if (function_exists('is_product') && is_product()) { $product_layout = sf_get_post_meta($post->ID, 'sf_product_layout', true); $page_class .= 'product-' . $product_layout . ' '; } // Layout if (isset($_GET['layout'])) { $page_layout = $_GET['layout']; } $page_class .= "layout-" . $page_layout . " "; // Article Swipe if ($enable_articleswipe) { $page_class .= 'article-swipe '; } if ($home_preloader && (is_home() || is_front_page()) && !is_paged()) { $page_class .= 'sf-preloader '; } if ($enable_newsletter_sub_bar && (is_home() || is_front_page()) && !is_paged() || $enable_newsletter_sub_bar_page) { $page_class .= 'has-newsletter-bar '; } // Page Heading if ($post && is_singular()) { $show_page_title = sf_get_post_meta($post->ID, 'sf_page_title', true); $remove_breadcrumbs = sf_get_post_meta($post->ID, 'sf_no_breadcrumbs', true); $page_title_style = sf_get_post_meta($post->ID, 'sf_page_title_style', true); if (function_exists('is_product') && is_product() && sf_theme_supports('product-inner-heading') && $page_title_style == "fancy-tabbed") { $page_title_style = "fancy"; } if ($show_page_title) { $page_class .= 'page-heading-' . $page_title_style . ' '; } } $shop_page = false; if (function_exists('is_shop') && is_shop() || function_exists('is_product_category') && is_product_category()) { $shop_page = true; } if ($shop_page) { $show_page_title = $sf_options['woo_show_page_heading']; $page_title_style = $sf_options['woo_page_heading_style']; if ($show_page_title) { $page_class .= 'page-heading-' . $page_title_style . ' '; } } if (sf_woocommerce_activated()) { if (isset($sf_options['shop_icon_style'])) { $shop_icon_style = $sf_options['shop_icon_style']; } $page_class .= 'shop-icon-' . $shop_icon_style . ' '; if (isset($sf_options['minimal_checkout'])) { if ($sf_options['minimal_checkout']) { $page_class .= 'minimal-checkout '; } } } if ($sf_options['disable_mobile_animations']) { $page_class .= "disable-mobile-animations "; } $global_filters = false; if (isset($sf_options['enable_woo_global_filters'])) { $global_filters = $sf_options['enable_woo_global_filters']; if ($global_filters) { $page_class .= 'woo-global-filters-enabled '; } } // Return array of classes $class_array = array("page-layout" => $page_layout, "page" => $page_class, "header-layout" => $header_layout, "header-wrap" => $header_wrap_class, "logo" => $logo_class, "search-type" => $header_search_type); return $class_array; }
function widget($args, $instance) { global $post, $sf_options; extract($args); $remove_dates = $sf_options['remove_dates']; // Widget Options $title = apply_filters('widget_title', $instance['title']); // Title $post_id = $instance['post_id']; // Post ID echo $before_widget; if ($title) { echo $before_title . $title . $after_title; } if (function_exists('icl_object_id')) { $post_id = icl_object_id($post_id, 'post', true); } $infocus_post = get_post($post_id); ?> <div class="infocus-item"> <?php $post_title = $infocus_post->post_title; $post_permalink = get_post_permalink($infocus_post); $thumb_image = rwmb_meta('sf_thumbnail_image', 'type=image&size=full', $post_id); $thumb_video = sf_get_post_meta($post_id, 'sf_thumbnail_video_url', true); foreach ($thumb_image as $detail_image) { $thumb_img_url = $detail_image['url']; break; } if (!$thumb_image) { $thumb_image = get_post_thumbnail_id($post_id); $thumb_img_url = wp_get_attachment_url($thumb_image, 'full'); } $image = sf_aq_resize($thumb_img_url, 300, 225, true, false); $image_alt = esc_attr(sf_get_post_meta($thumb_image, '_wp_attachment_image_alt', true)); ?> <figure class="animated-overlay overlay-alt"> <?php if (sf_theme_opts_name() == "sf_atelier_options") { $post_date_month = get_the_date('M'); $post_date_day = get_the_date('d'); ?> <div class="date-overlay narrow-date-block"><span class="month"><?php echo $post_date_month; ?> </span><span class="day"><?php echo $post_date_day; ?> </span></div> <?php } ?> <?php if ($thumb_video != "") { ?> <?php echo sf_video_embed($thumb_video, 300, 200); ?> <?php } else { if ($image) { ?> <img src="<?php echo $image[0]; ?> " width="<?php echo $image[1]; ?> " height="<?php echo $image[2]; ?> " alt="<?php echo $image_alt; ?> "/> <a href="<?php echo $post_permalink; ?> " class="infocus-image"></a> <div class="figcaption-wrap"></div> <figcaption> <div class="thumb-info thumb-info-alt"> <?php echo apply_filters('sf_next_icon', '<i class="ss-navigateright"></i>'); ?> </div> </figcaption> <?php } } ?> </figure> <div class="infocus-title clearfix"> <?php if (sf_theme_opts_name() == "sf_atelier_options") { ?> <h4><a href="<?php echo $post_permalink; ?> " title="<?php echo $post_title; ?> "><?php echo $post_title; ?> </a></h4> <?php } else { if (sf_theme_opts_name() == "sf_uplift_options") { ?> <h5><a href="<?php echo $post_permalink; ?> " title="<?php echo $post_title; ?> "><?php echo $post_title; ?> </a></h5> <?php if (!$remove_dates) { echo '<div class="blog-item-details">' . sprintf(__('<time datetime="%1$s">%2$s</time>', 'swiftframework'), get_the_date('Y-m-d'), get_the_date()) . '</div>'; } ?> <?php } else { ?> <h5><a href="<?php echo $post_permalink; ?> " title="<?php echo $post_title; ?> "><?php echo $post_title; ?> </a></h5> <div class="comments-likes"> <?php if (function_exists('lip_love_it_link')) { echo lip_love_it_link($post_id, '<i class="ss-heart"></i>', '<i class="ss-heart"></i>', false); } ?> </div> <?php } } ?> </div> </div> <?php echo $after_widget; }
?> </option> <option value="shortcode-social"><?php _e('Social', 'swiftframework'); ?> </option> <option value="shortcode-social-share"><?php _e('Social share', 'swiftframework'); ?> </option> <option value="shortcode-tables"><?php _e('Table', 'swiftframework'); ?> </option> <?php if (sf_theme_opts_name() != "sf_atelier_options") { ?> <option value="shortcode-tooltip"><?php _e('Tooltip', 'swiftframework'); ?> </option> <?php } ?> <option value="shortcode-typography"><?php _e('Typography', 'swiftframework'); ?> </option> </select> </div>
function sf_get_wishlist() { global $wpdb, $yith_wcwl, $woocommerce; if (!$yith_wcwl || !$woocommerce) { return; } $wishlist_output = ""; if (is_user_logged_in()) { $user_id = get_current_user_id(); } $wishlist_icon = apply_filters('sf_view_wishlist_icon', '<i class="ss-star"></i>'); $count = array(); if (is_user_logged_in()) { $count = $wpdb->get_results($wpdb->prepare('SELECT COUNT(*) as `cnt` FROM `' . YITH_WCWL_TABLE . '` WHERE `user_id` = %d', $user_id), ARRAY_A); $count = $count[0]['cnt']; } else { $count[0]['cnt'] = count(yith_getcookie('yith_wcwl_products')); $count = $count[0]['cnt']; } if (is_array($count)) { $count = 0; } if (sf_theme_opts_name() == "sf_atelier_options" || sf_theme_opts_name() == "sf_uplift_options") { $wishlist_output .= '<li class="parent wishlist-item"><a class="wishlist-link" href="' . $yith_wcwl->get_wishlist_url() . '" title="' . __("View your wishlist", "swiftframework") . '"><span class="menu-item-title">' . __("Wishlist", "swiftframework") . '</span> ' . apply_filters('sf_wishlist_menu_icon', '<i class="ss-star"></i>') . '<span class="count">' . $count . '</span><span class="star"></span></a>'; } else { $wishlist_output .= '<li class="parent wishlist-item"><a class="wishlist-link" href="' . $yith_wcwl->get_wishlist_url() . '" title="' . __("View your wishlist", "swiftframework") . '">' . apply_filters('sf_wishlist_menu_icon', '<i class="ss-star"></i>') . '<span class="count">' . $count . '</span><span class="star"></span></a>'; } $wishlist_output .= '<ul class="sub-menu">'; $wishlist_output .= '<li>'; $wishlist_output .= '<div class="wishlist-bag">'; $current_page = 1; $limit_sql = ''; $count_limit = 0; if (is_user_logged_in()) { $wishlist = $wpdb->get_results($wpdb->prepare("SELECT * FROM `" . YITH_WCWL_TABLE . "` WHERE `user_id` = %s" . $limit_sql, $user_id), ARRAY_A); } else { $wishlist = yith_getcookie('yith_wcwl_products'); } $wishlist_output .= '<div class="bag-contents">'; $wishlist_output .= do_action('yith_wcwl_before_wishlist'); if (count($wishlist) > 0) { foreach ($wishlist as $values) { if ($count_limit < 3) { if (!is_user_logged_in()) { if (isset($values['add-to-wishlist']) && is_numeric($values['add-to-wishlist'])) { $values['prod_id'] = $values['add-to-wishlist']; $values['ID'] = $values['add-to-wishlist']; } else { if (isset($values['product_id'])) { $values['prod_id'] = $values['product_id']; $values['ID'] = $values['product_id']; } else { $values['ID'] = $values['prod_id']; } } } $product_obj = get_product($values['prod_id']); if ($product_obj !== false && $product_obj->exists()) { $wishlist_output .= '<div id="wishlist-' . $values['ID'] . '" class="bag-product clearfix prod-' . $values['prod_id'] . '">'; if (has_post_thumbnail($product_obj->id)) { $image_link = wp_get_attachment_url(get_post_thumbnail_id($product_obj->id)); $image = wp_get_attachment_image_src(get_post_thumbnail_id($product_obj->id), 'thumbnail'); if ($image) { $wishlist_output .= '<figure><a class="bag-product-img" href="' . esc_url(get_permalink(apply_filters('woocommerce_in_cart_product', $values['prod_id']))) . '"><img itemprop="image" src="' . $image[0] . '" width="' . $image[1] . '" height="' . $image[2] . '" /></a></figure>'; } } $wishlist_output .= '<div class="bag-product-details">'; $wishlist_output .= '<div class="bag-product-title"><a href="' . esc_url(get_permalink(apply_filters('woocommerce_in_cart_product', $values['prod_id']))) . '">' . apply_filters('woocommerce_in_cartproduct_obj_title', $product_obj->get_title(), $product_obj) . '</a></div>'; if (get_option('woocommerce_display_cart_prices_excluding_tax') == 'yes') { $wishlist_output .= '<div class="bag-product-price">' . apply_filters('woocommerce_cart_item_price_html', woocommerce_price($product_obj->get_price_excluding_tax()), $values, '') . '</div>'; } else { $wishlist_output .= '<div class="bag-product-price">' . apply_filters('woocommerce_cart_item_price_html', woocommerce_price($product_obj->get_price()), $values, '') . '</div>'; } $wishlist_output .= '</div>'; $wishlist_output .= '</div>'; } $count_limit++; } } } else { $wishlist_output .= '<div class="wishlist-empty">' . __('Your wishlist is empty.', 'swiftframework') . '</div>'; } $wishlist_output .= '</div>'; if (count($wishlist) > 0) { $wishlist_output .= '<div class="bag-buttons">'; } else { $wishlist_output .= '<div class="bag-buttons no-items">'; } $wishlist_output .= '<a class="sf-button standard sf-icon-reveal wishlist-button" href="' . $yith_wcwl->get_wishlist_url() . '">' . $wishlist_icon . '<span class="text">' . __('View Wishlist', 'swiftframework') . '</span></a>'; $wishlist_output .= '</div>'; $wishlist_output .= '</div>'; $wishlist_output .= '</li>'; $wishlist_output .= '</ul>'; $wishlist_output .= '</li>'; return $wishlist_output; }
function sf_post_pagination() { global $sf_options, $sf_sidebar_config; $single_author = $sf_options['single_author']; $remove_dates = $sf_options['remove_dates']; $pagination_style = "standard"; if (isset($sf_options['pagination_style'])) { $pagination_style = $sf_options['pagination_style']; } $enable_category_navigation = $sf_options['enable_category_navigation']; $prev_post = get_next_post($enable_category_navigation, '', 'category'); $next_post = get_previous_post($enable_category_navigation, '', 'category'); $has_both = false; if (sf_theme_opts_name() == "sf_joyn_options" && $pagination_style == "fs-arrow") { return; } if (!empty($next_post) && !empty($prev_post)) { $has_both = true; } ?> <?php if (!empty($next_post) || !empty($prev_post)) { ?> <?php if ($has_both) { ?> <div class="post-pagination-wrap prev-next"> <?php } else { ?> <div class="post-pagination-wrap"> <?php } ?> <div class="container"> <?php if (!empty($next_post)) { $author_id = $next_post->post_author; $author_name = get_the_author_meta('display_name', $author_id); $author_url = get_author_posts_url($author_id); $post_date = get_the_date(); $post_date_str = get_the_date('Y-m-d'); $post_categories = get_the_category_list(', ', '', $next_post->ID); ?> <div class="next-article"> <h6><?php _e("Next Article", 'swiftframework'); ?> </h6> <h2> <a href="<?php echo get_permalink($next_post->ID); ?> "><?php echo $next_post->post_title; ?> </a> </h2> <?php if ($single_author && !$remove_dates) { ?> <div class="blog-item-details"><?php echo sprintf(__('In %1$s on <time datetime="%2$s">%3$s</time>', 'swiftframework'), $post_categories, $post_date_str, $post_date); ?> </div> <?php } else { if (!$remove_dates) { ?> <div class="blog-item-details"><?php echo sprintf(__('<span class="author">By <a href="%2$s" rel="author" itemprop="author">%1$s</a></span> in %3$s on <time datetime="%4$s">%5$s</time>', 'swiftframework'), $author_name, $author_url, $post_categories, $post_date_str, $post_date); ?> </div> <?php } else { if (!$single_author) { ?> <div class="blog-item-details"><?php echo sprintf(__('<span class="author">By <a href="%2$s" rel="author" itemprop="author">%1$s</a></span> in %3$s', 'swiftframework'), $author_name, $author_url, $post_categories); ?> </div> <?php } } } ?> </div> <?php } ?> <?php if (!empty($prev_post)) { $author_id = $prev_post->post_author; $author_name = get_the_author_meta('display_name', $author_id); $author_url = get_author_posts_url($author_id); $post_date = get_the_date(); $post_date_str = get_the_date('Y-m-d'); $post_categories = get_the_category_list(', ', '', $prev_post->ID); ?> <div class="prev-article"> <h6><?php _e("Previous Article", 'swiftframework'); ?> </h6> <h2> <a href="<?php echo get_permalink($prev_post->ID); ?> "><?php echo $prev_post->post_title; ?> </a> </h2> <?php if ($single_author && !$remove_dates) { ?> <div class="blog-item-details"><?php echo sprintf(__('In %1$s on <time datetime="%2$s">%3$s</time>', 'swiftframework'), $post_categories, $post_date_str, $post_date); ?> </div> <?php } else { if (!$remove_dates) { ?> <div class="blog-item-details"><?php echo sprintf(__('<span class="author">By <a href="%2$s" rel="author" itemprop="author">%1$s</a></span> in %3$s on <time datetime="%4$s">%5$s</time>', 'swiftframework'), $author_name, $author_url, $post_categories, $post_date_str, $post_date); ?> </div> <?php } else { if (!$single_author) { ?> <div class="blog-item-details"><?php echo sprintf(__('<span class="author">By <a href="%2$s" rel="author" itemprop="author">%1$s</a></span> in %3$s', 'swiftframework'), $author_name, $author_url, $post_categories); ?> </div> <?php } } } ?> </div> <?php } ?> </div> </div> <?php } ?> <?php }
function sf_portfolio_items($atts) { extract(shortcode_atts(array('title' => '', 'display_type' => '', 'multi_size_ratio' => '', 'fullwidth' => '', 'gutters' => '', 'columns' => '', 'show_title' => '', 'show_subtitle' => '', 'show_excerpt' => '', 'hover_show_excerpt' => '', 'excerpt_length' => '', 'item_count' => '', 'category' => '', 'order' => '', 'order_by' => '', 'portfolio_filter' => '', 'pagination' => '', 'button_enabled' => '', 'hover_style' => 'default', 'post_type' => 'portfolio', 'el_position' => '', 'width' => '', 'el_class' => ''), $atts)); /* OUTPUT VARIABLE ================================================== */ $portfolio_items_output = $grid_size = ""; $count = 0; /* CATEGORY SLUG MODIFICATION ================================================== */ if ($category == "All") { $category = "all"; } if ($category == "all") { $category = ''; } $category_slug = str_replace('_', '-', $category); /* PORTFOLIO QUERY SETUP ================================================== */ global $post, $wp_query; if (get_query_var('paged')) { $paged = get_query_var('paged'); } elseif (get_query_var('page')) { $paged = get_query_var('page'); } else { $paged = 1; } $categories = explode(",", $category_slug); $translated_categories = ''; foreach ($categories as $key => $category_slug) { $category_id_by_slug = get_term_by('slug', $category_slug, 'portfolio-category'); if (isset($category_id_by_slug->term_id)) { $translated_slug_id = apply_filters('wpml_object_id', $category_id_by_slug->term_id, 'custom taxonomy', true); $translated_slug = get_term_by('id', $translated_slug_id, 'portfolio-category'); $translated_categories = $translated_categories . ($key < count($categories) - 1 ? $translated_slug->slug . ',' : $translated_slug->slug); } } $portfolio_args = array('post_type' => $post_type, 'post_status' => 'publish', 'paged' => $paged, 'portfolio-category' => $translated_categories, 'posts_per_page' => $item_count, 'order' => $order, 'orderby' => $order_by); $portfolio_items = new WP_Query($portfolio_args); /* LIST CLASS CONFIG ================================================== */ $list_class = ''; if ($display_type == "masonry" || $display_type == "masonry-gallery") { $list_class .= 'masonry-items filterable-items col-' . $columns . ' row clearfix'; } else { if ($display_type == "gallery") { $list_class .= 'gallery-portfolio filterable-items col-' . $columns . ' row clearfix'; } else { if ($display_type == "multi-size-masonry") { $columns = 3; $list_class .= 'multi-masonry-items filterable-items col-' . $columns . ' row clearfix'; } else { $list_class .= 'standard-portfolio filterable-items col-' . $columns . ' row clearfix'; } } } // Full width if ($fullwidth == "yes") { $list_class .= ' portfolio-full-width'; } // Gutters if ($gutters == "no") { $list_class .= ' no-gutters'; } else { $list_class .= ' gutters'; } // Thumb Type if (function_exists('sf_get_thumb_type') && sf_theme_opts_name() == "sf_atelier_options") { $list_class .= ' ' . sf_get_thumb_type(); } else { if (function_exists('sf_get_thumb_type') && $hover_style == "default") { $list_class .= ' ' . sf_get_thumb_type(); } else { $list_class .= ' thumbnail-' . $hover_style; } } if ($display_type == "multi-size-masonry") { if ($fullwidth == "yes") { $grid_size = 'col-sm-3'; } else { $grid_size = 'col-sm-4'; } } /* ITEMS OUTPUT ================================================== */ global $sf_options; $portfolio_items_output .= '<ul class="portfolio-items ' . $list_class . '">' . "\n"; if ($display_type == "multi-size-masonry") { $portfolio_items_output .= '<li class="clearfix portfolio-item ' . $grid_size . ' grid-sizer">' . "\n"; } while ($portfolio_items->have_posts()) { $portfolio_items->the_post(); /* META VARIABLES ================================================== */ $thumb_type = sf_get_post_meta($post->ID, 'sf_thumbnail_type', true); $item_title = get_the_title(); $item_subtitle = sf_get_post_meta($post->ID, 'sf_portfolio_subtitle', true); $permalink = get_permalink(); $custom_excerpt = sf_get_post_meta($post->ID, 'sf_custom_excerpt', true); $post_excerpt = ''; if ($custom_excerpt != '') { $post_excerpt = sf_custom_excerpt($custom_excerpt, $excerpt_length); } else { $post_excerpt = sf_excerpt($excerpt_length); } $taxonomy_name = 'category'; if ($post_type != "post") { $taxonomy_name = $post_type . '-category'; } if ($taxonomy_name == "product-category") { $taxonomy_name = "product_cat"; } $post_terms = get_the_terms($post->ID, $taxonomy_name); $term_slug = " "; if (!empty($post_terms)) { foreach ($post_terms as $post_term) { $term_slug = $term_slug . strtolower($post_term->slug) . ' '; } } /* COLUMN VARIABLE CONFIG ================================================== */ $item_class = ""; if ($columns == "1") { $item_class = "col-sm-12 "; } else { if ($columns == "2") { $item_class = "col-sm-6 "; } else { if ($columns == "3") { $item_class = "col-sm-4 "; } else { if ($columns == "4") { $item_class = "col-sm-3 "; } else { if ($columns == "5") { $item_class = "col-sm-sf-5 "; } } } } } $masonry_thumb_size = sf_get_post_meta(get_the_ID(), 'sf_masonry_thumb_size', true); if ($display_type == "multi-size-masonry") { if ($fullwidth == "yes") { if ($masonry_thumb_size == "") { $masonry_thumb_size = "standard"; } if ($masonry_thumb_size == "wide") { $item_class = 'col-sm-6 size-wide '; } else { if ($masonry_thumb_size == "tall") { $item_class = 'col-sm-3 size-tall '; } else { if ($masonry_thumb_size == "wide-tall") { $item_class = 'col-sm-6 size-wide-tall '; } else { $item_class = 'col-sm-3 size-standard '; } } } } else { if ($masonry_thumb_size == "") { $masonry_thumb_size = "standard"; } if ($masonry_thumb_size == "wide") { $item_class = 'col-sm-8 size-wide '; } else { if ($masonry_thumb_size == "tall") { $item_class = 'col-sm-4 size-tall '; } else { if ($masonry_thumb_size == "wide-tall") { $item_class = 'col-sm-8 size-wide-tall '; } else { $item_class = 'col-sm-4 size-standard '; } } } } } /* DISPLAY TYPE CONFIG ================================================== */ if ($display_type == "masonry") { $item_class .= "masonry-item masonry-gallery-item"; } else { if ($display_type == "masonry-gallery") { $item_class .= "masonry-item masonry-gallery-item gallery-item"; } else { if ($display_type == "gallery") { $item_class .= "gallery-item "; } else { if ($display_type == "multi-size-masonry") { $item_class .= "multi-masonry-item "; } else { $item_class .= "standard "; } } } } $item_class = apply_filters('sf_portfolio_item_class', $item_class); /* LINK TYPE CONFIG ================================================== */ $item_link = sf_portfolio_item_link(); /* ITEM OUTPUT ================================================== */ $portfolio_items_output .= '<li itemscope itemtype="http://schema.org/CreativeWork" data-id="id-' . $count . '" class="clearfix portfolio-item ' . $item_class . ' ' . $term_slug . '">' . "\n"; $portfolio_items_output .= apply_filters('sf_before_portfolio_item_thumb', ''); $portfolio_items_output .= '<div class="portfolio-item-wrap">' . "\n"; /* THUMBNAIL CONFIG ================================================== */ if ($thumb_type != "none") { $portfolio_items_output .= sf_portfolio_thumbnail($display_type, $masonry_thumb_size, $multi_size_ratio, $columns, $hover_show_excerpt, $excerpt_length, $gutters, $fullwidth); } $portfolio_items_output .= apply_filters('sf_after_portfolio_item_thumb', ''); $port_title_tag = apply_filters('sf_portfolio_item_title_tag', 'h3'); $port_subtitle_tag = apply_filters('sf_portfolio_item_subtitle_tag', 'h5'); if ($display_type != "gallery" && $display_type != "masonry-gallery" && $display_type != "multi-size-masonry") { $portfolio_items_output .= '<div class="portfolio-item-details">' . "\n"; if ($show_title == "yes") { $portfolio_items_output .= '<div class="comments-likes">'; if (function_exists('lip_love_it_link')) { $portfolio_items_output .= lip_love_it_link(get_the_ID(), false); } $portfolio_items_output .= '</div>'; $portfolio_items_output .= '<' . $port_title_tag . ' class="portfolio-item-title" itemprop="name headline"><a ' . $item_link['config'] . '>' . $item_title . '</a></' . $port_title_tag . '>' . "\n"; } if ($show_subtitle == "yes" && $item_subtitle) { $portfolio_items_output .= '<' . $port_subtitle_tag . ' class="portfolio-subtitle" itemprop="name alternativeHeadline">' . $item_subtitle . '</' . $port_subtitle_tag . '>' . "\n"; } if ($show_excerpt == "yes") { $portfolio_items_output .= '<div class="portfolio-item-excerpt" itemprop="description">' . $post_excerpt . '</div>' . "\n"; } $portfolio_items_output .= '</div>' . "\n"; } $portfolio_items_output .= '</div>' . "\n"; $portfolio_items_output .= '</li>' . "\n"; $count++; } wp_reset_query(); wp_reset_postdata(); $portfolio_items_output .= '</ul>' . "\n"; /* PAGINATION OUTPUT ================================================== */ if ($pagination == "infinite-scroll") { global $sf_include_infscroll; $sf_include_infscroll = true; $portfolio_items_output .= '<div class="pagination-wrap hidden">'; $portfolio_items_output .= pagenavi($portfolio_items); $portfolio_items_output .= '</div>'; } else { if ($pagination == "load-more") { global $sf_include_infscroll; $sf_include_infscroll = true; $portfolio_items_output .= '<a href="#" class="load-more-btn">' . __('Load More', 'swiftframework') . '</a>'; $portfolio_items_output .= '<div class="pagination-wrap load-more hidden">'; $portfolio_items_output .= pagenavi($portfolio_items); $portfolio_items_output .= '</div>'; } else { if ($pagination == "standard" || $pagination == "yes") { if ($display_type == "masonry") { $portfolio_items_output .= '<div class="pagination-wrap masonry-pagination">'; } else { $portfolio_items_output .= '<div class="pagination-wrap">'; } $portfolio_items_output .= pagenavi($portfolio_items); $portfolio_items_output .= '</div>'; } } } /* FUNCTION OUTPUT ================================================== */ return $portfolio_items_output; }
function sf_product_shop_count() { $options = get_option(sf_theme_opts_name()); $default_count = $products_per_page = $options['products_per_page']; $count = isset($_GET['show_products']) ? $_GET['show_products'] : $default_count; if ($count === 'all') { $count = -1; } else { if (!is_numeric($count)) { $count = $default_count; } } return $count; }
function sf_portfolio_related_projects() { global $post, $sf_options; $fullwidth = $sf_options['related_projects_fullwidth']; $gutters = false; if (isset($sf_options['related_projects_gutters'])) { $gutters = $sf_options['related_projects_gutters']; } $item_count = $sf_options['related_projects_columns']; $related = sf_portfolio_related_posts($post->ID, $item_count); $item_class = "col-sm-4"; $wrap_class = $heading_class = ""; if ($fullwidth) { $heading_class = "container"; } else { $wrap_class = "container"; } $hover_style = "default"; if ($gutters) { $wrap_class .= " gutters"; } else { $wrap_class .= " no-gutters"; } // Thumb Type if (function_exists('sf_get_thumb_type') && sf_theme_opts_name() == "sf_atelier_options") { $wrap_class .= ' ' . sf_get_thumb_type(); } else { if (function_exists('sf_get_thumb_type') && $hover_style == "default") { $wrap_class .= ' ' . sf_get_thumb_type(); } else { $wrap_class .= ' thumbnail-' . $hover_style; } } if ($item_count == "4") { $item_class = "col-sm-3"; } if (sf_theme_supports('alt-gallery-hover')) { $item_class .= " portfolio-item gallery-item"; } if ($related->have_posts()) { ?> <section class="related-projects <?php echo esc_attr($wrap_class); ?> clearfix"> <h2 class="<?php echo esc_attr($heading_class); ?> "><?php echo apply_filters('sf_related_projects_heading', __("Related Projects", "swiftframework")); ?> </h2> <div class="row clearfix"> <?php while ($related->have_posts()) { $related->the_post(); ?> <?php $item_title = get_the_title(); $item_subtitle = sf_get_post_meta($post->ID, 'sf_portfolio_subtitle', true); $thumb_image = $port_hover_style = $port_hover_text_style = ""; $thumb_image = sf_get_post_meta($post->ID, 'sf_thumbnail_image', true); if (!$thumb_image) { $thumb_image = get_post_thumbnail_id(); } $thumb_img_url = wp_get_attachment_url($thumb_image, 'full'); if ($thumb_img_url == "") { $thumb_img_url = "default"; } $image = sf_aq_resize($thumb_img_url, 500, 375, true, false); $image_alt = esc_attr(sf_get_post_meta($thumb_image, '_wp_attachment_image_alt', true)); $port_hover_bg_color = sf_get_post_meta($post->ID, 'sf_port_hover_bg_color', true); $port_hover_text_color = sf_get_post_meta($post->ID, 'sf_port_hover_text_color', true); if ($port_hover_bg_color != "") { if (isset($sf_options['overlay_opacity'])) { $overlay_opacity = $sf_options['overlay_opacity']; if ($overlay_opacity == 100) { $overlay_opacity = '1'; } else { $overlay_opacity = '0.' . $overlay_opacity; } $port_hover_bg_rgb = sf_hex2rgb($port_hover_bg_color); $port_hover_style = 'style="background-color:rgba(' . $port_hover_bg_rgb['red'] . ',' . $port_hover_bg_rgb['green'] . ',' . $port_hover_bg_rgb['blue'] . ',' . $overlay_opacity . ');"'; } else { if (isset($sf_options['overlay_opacity_top'])) { $overlay_opacity_top = $sf_options['overlay_opacity_top']; $overlay_opacity_bottom = $sf_options['overlay_opacity_bottom']; $port_hover_bg_rgb = sf_hex2rgb($port_hover_bg_color); if ($overlay_opacity_top < 100 || $overlay_opacity_bottom < 100) { $overlay_opacity_top = $overlay_opacity_top < 100 ? '0.' . $overlay_opacity_top : '1.0'; $overlay_opacity_bottom = $overlay_opacity_bottom < 100 ? '0.' . $overlay_opacity_bottom : '1.0'; $port_hover_style = 'style="background: -webkit-gradient(linear,left top,left bottom,color-stop(25%,rgba(' . $port_hover_bg_rgb["red"] . ',' . $port_hover_bg_rgb["green"] . ',' . $port_hover_bg_rgb["blue"] . ', ' . $overlay_opacity_top . ')),to(rgba(' . $port_hover_bg_rgb["red"] . ',' . $port_hover_bg_rgb["green"] . ',' . $port_hover_bg_rgb["blue"] . ', ' . $overlay_opacity_bottom . '))); background: -webkit-linear-gradient(top, rgba(' . $port_hover_bg_rgb["red"] . ',' . $port_hover_bg_rgb["green"] . ',' . $port_hover_bg_rgb["blue"] . ', ' . $overlay_opacity_top . ') 25%,rgba(' . $port_hover_bg_rgb["red"] . ',' . $port_hover_bg_rgb["green"] . ',' . $port_hover_bg_rgb["blue"] . ', ' . $overlay_opacity_bottom . ') 100%); background: linear-gradient(to bottom, rgba(' . $port_hover_bg_rgb["red"] . ',' . $port_hover_bg_rgb["green"] . ',' . $port_hover_bg_rgb["blue"] . ', ' . $overlay_opacity_top . ') 25%, rgba(' . $port_hover_bg_rgb["red"] . ',' . $port_hover_bg_rgb["green"] . ',' . $port_hover_bg_rgb["blue"] . ', ' . $overlay_opacity_bottom . ') 100%);"'; } } } } if ($port_hover_text_color != "") { $port_hover_text_style = 'style="color: ' . $port_hover_text_color . ';"'; } ?> <article class="<?php echo esc_attr($item_class); ?> "> <figure class="animated-overlay overlay-style"> <img src="<?php echo esc_url($image[0]); ?> " width="<?php echo esc_attr($image[1]); ?> " height="<?php echo esc_attr($image[2]); ?> " alt="<?php echo esc_attr($image_alt); ?> "/> <a href="<?php the_permalink(); ?> "></a> <figcaption <?php echo esc_attr($port_hover_style); ?> > <div class="thumb-info"> <h4 <?php echo esc_attr($port_hover_text_style); ?> ><?php echo esc_attr($item_title); ?> </h4> <div class="name-divide"></div> <h5 <?php echo esc_attr($port_hover_text_style); ?> ><?php echo esc_attr($item_subtitle); ?> </h5> </div> </figcaption> </figure> </article> <?php } ?> </div> </section> <?php } }