本文整理匯總了PHP中sf_theme_opts_name函數的典型用法代碼示例。如果您正苦於以下問題:PHP sf_theme_opts_name函數的具體用法?PHP sf_theme_opts_name怎麽用?PHP sf_theme_opts_name使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了sf_theme_opts_name函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: lip_love_it_link
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());
}
}
示例2: sf_woo_header_add_to_cart_fragment
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
//.........這裏部分代碼省略.........
示例3: sf_product_items
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") {
?>
//.........這裏部分代碼省略.........
示例4: sf_page_heading
//.........這裏部分代碼省略.........
}
// 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
示例5: widget
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 {
//.........這裏部分代碼省略.........
示例6: sf_post_pagination
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');
?>
//.........這裏部分代碼省略.........
示例7: sf_get_recent_post_item
//.........這裏部分代碼省略.........
$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;
}
示例8: sf_page_classes
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 ";
}
}
//.........這裏部分代碼省略.........
示例9: widget
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">
//.........這裏部分代碼省略.........
示例10: _e
?>
</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>
示例11: sf_get_wishlist
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;
}
示例12: sf_post_pagination
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)) {
//.........這裏部分代碼省略.........
示例13: sf_portfolio_items
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 != '') {
//.........這裏部分代碼省略.........
示例14: sf_product_shop_count
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;
}
示例15: sf_portfolio_related_projects
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%);"';
}
}
}
}
//.........這裏部分代碼省略.........