本文整理汇总了PHP中sf_custom_excerpt函数的典型用法代码示例。如果您正苦于以下问题:PHP sf_custom_excerpt函数的具体用法?PHP sf_custom_excerpt怎么用?PHP sf_custom_excerpt使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sf_custom_excerpt函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sf_directory_items
function sf_directory_items($excerpt_length, $pagination, $item_count, $directory_cat)
{
/* OUTPUT VARIABLE
================================================== */
$directory_items_output = $grid_size = "";
$count = 0;
$order = "standard";
/* DIRECTORY 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;
}
$order_mode = $order_by = "";
if ($order == "standard") {
$order_mode = "DESC";
$order_by = "date";
} else {
if ($order == "date-asc") {
$order_mode = "ASC";
$order_by = "date";
} else {
if ($order == "title-desc") {
$order_mode = "DESC";
$order_by = "title";
} else {
if ($order == "title-asc") {
$order_mode = "ASC";
$order_by = "title";
}
}
}
}
$tax_query = array();
$tax_query_category = array();
$tax_query_location = array();
if (isset($directory_cat) && $directory_cat != '' && $directory_cat != 'All') {
$directory_cat_array = array();
$directory_cat_array = explode(",", $directory_cat);
$tax_query_category = array('taxonomy' => 'directory-category', 'field' => 'slug', 'terms' => $directory_cat_array);
array_push($tax_query, $tax_query_category);
}
if (isset($_POST['dir-category-id']) && $_POST['dir-category-id'] != '' && $_POST['dir-category-id'] != 'All') {
$category_term = $_POST['dir-category-id'];
$tax_query_category = array('taxonomy' => 'directory-category', 'field' => 'slug', 'terms' => array($category_term));
array_push($tax_query, $tax_query_category);
}
if (isset($_POST['dir-location-id']) && $_POST['dir-location-id'] != '' && $_POST['dir-location-id'] != 'All') {
$location_term = $_POST['dir-location-id'];
$tax_query_location = array('taxonomy' => 'directory-location', 'field' => 'slug', 'terms' => array($location_term));
array_push($tax_query, $tax_query_location);
}
$search_term = "";
if (isset($_POST['dir-search-value'])) {
$search_term = $_POST['dir-search-value'];
}
//Get all itens when there is no pagination
if ($pagination != 'yes') {
$item_count = -1;
}
$directory_args = array('s' => $search_term, 'post_type' => 'directory', 'post_status' => 'publish', 'paged' => $paged, 'posts_per_page' => $item_count, 'order' => $order_mode, 'orderby' => $order_by, 'tax_query' => $tax_query, 'meta_query' => array('relation' => 'AND', array('key' => 'sf_directory_address', 'value' => '', 'compare' => '!=')));
$directory_items = new WP_Query($directory_args);
/* ITEMS OUTPUT
================================================== */
global $sf_options;
$directory_items_output .= '<div class="directory-list-results">';
while ($directory_items->have_posts()) {
$directory_items->the_post();
$directory_items_output .= '<div class="directory-item clearfix">';
/* META VARIABLES
================================================== */
$item_title = get_the_title();
$img_src = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'thumb-image');
$pin_link = esc_url(sf_get_post_meta($post->ID, 'sf_directory_pin_link', true));
$pin_button_text = sf_get_post_meta($post->ID, 'sf_directory_pin_button_text', true);
$custom_excerpt = sf_get_post_meta($post->ID, 'sf_custom_excerpt', true);
$post_excerpt = '';
if ($excerpt_length != '') {
if ($custom_excerpt != '') {
$post_excerpt = sf_custom_excerpt($custom_excerpt, $excerpt_length);
} else {
$post_excerpt = sf_excerpt($excerpt_length);
}
} else {
$post_excerpt = sf_excerpt(200);
}
$post_excerpt .= ' <a class="read-more-directory" href="' . get_permalink($post->ID) . '"> ' . __('Read More', 'swiftframework') . '</a>';
$post_terms = get_the_terms($post->ID, 'directory-category');
$term_slug = " ";
$category_list_text = "";
if (!empty($post_terms)) {
foreach ($post_terms as $post_term) {
$term_slug = $term_slug . $post_term->slug . ' ';
$category_list_text .= $post_term->name . ' | ';
}
}
//.........这里部分代码省略.........
示例2: content
protected function content($atts, $content = null)
{
$options = get_option('sf_dante_options');
$title = $category = $item_class = $excerpt_length = $width = $offset = $el_class = $output = $filter = $items = $el_position = $item_count = '';
extract(shortcode_atts(array('title' => '', 'show_title' => 'yes', 'show_excerpt' => 'yes', "excerpt_length" => '20', "item_count" => '12', "show_details" => 'yes', "offset" => '0', "posts_order" => 'ASC', "category" => 'all', 'el_position' => '', 'width' => '1/1', 'el_class' => ''), $atts));
// CATEGORY SLUG MODIFICATION
if ($category == "All") {
$category = "all";
}
if ($category == "all") {
$category = '';
}
$category_slug = str_replace('_', '-', $category);
global $post, $wp_query, $sf_carouselID;
if ($sf_carouselID == "") {
$sf_carouselID = 1;
} else {
$sf_carouselID++;
}
$blog_args = array('post_type' => 'post', 'post_status' => 'publish', 'no_found_rows' => 1, 'category_name' => $category_slug, 'posts_per_page' => $item_count, 'offset' => $offset, 'order' => $posts_order);
$blog_items = new WP_Query($blog_args);
$count = $columns = 0;
$sidebar_config = sf_get_post_meta(get_the_ID(), 'sf_sidebar_config', true);
if (is_singular('portfolio')) {
$sidebar_config = "no-sidebars";
}
if ($sidebar_config == "left-sidebar" || $sidebar_config == "right-sidebar") {
$item_class = 'span2';
} else {
if ($sidebar_config == "both-sidebars") {
$item_class = 'span-bs-quarter';
} else {
$item_class = 'span3';
}
}
if ($width == "1/4") {
$columns = 1;
} else {
if ($width == "1/2") {
$columns = 2;
} else {
if ($width == "3/4") {
$columns = 3;
} else {
$columns = 4;
}
}
}
$items .= '<div class="carousel-wrap">';
$items .= '<div id="carousel-' . $sf_carouselID . '" class="blog-items carousel-items clearfix" data-columns="' . $columns . '">';
while ($blog_items->have_posts()) {
$blog_items->the_post();
$item_title = get_the_title();
$post_author = get_the_author_link();
$post_date = get_the_date();
$post_comments = get_comments_number();
$post_category = get_the_category();
$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');
$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);
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');
}
$thumb_lightbox_img_url = wp_get_attachment_url($thumb_lightbox_image, 'full');
$item_title = get_the_title();
$post_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);
}
if ($thumb_link_type == "link_to_url") {
$link_config = 'href="' . $thumb_link_url . '" class="link-to-url"';
$item_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 = "ss-link";
} else {
if ($thumb_link_type == "lightbox_thumb") {
$link_config = 'href="' . $thumb_img_url . '" class="lightbox" data-rel="ilightbox[' . $post_ID . ']"';
$item_icon = "ss-view";
} else {
if ($thumb_link_type == "lightbox_image") {
$lightbox_image_url = '';
foreach ($thumb_lightbox_image as $image) {
//.........这里部分代码省略.........
示例3: get_post_format
$post_format = get_post_format();
$post_title = get_the_title();
$post_author = get_the_author();
$post_date = get_the_date();
$post_date_str = get_the_date('Y-m-d');
$post_date_month = get_the_date('M');
$post_date_day = get_the_date('d');
$post_date_year = get_the_date('Y');
$post_categories = get_the_category_list(', ');
$post_comments = get_comments_number();
$post_permalink = get_permalink();
$custom_excerpt = sf_get_post_meta($post_id, 'sf_custom_excerpt', true);
$post_excerpt = '';
if ($content_output == "excerpt") {
if ($custom_excerpt != '') {
$post_excerpt = sf_custom_excerpt($custom_excerpt, $excerpt_length);
} else {
if ($post_format == "quote") {
$post_excerpt = sf_get_the_content_with_formatting();
} else {
$post_excerpt = sf_excerpt($excerpt_length);
}
}
} else {
$post_excerpt = sf_get_the_content_with_formatting();
}
if ($post_format == "chat") {
$post_excerpt = sf_content(40);
} else {
if ($post_format == "audio") {
$post_excerpt = do_shortcode(get_the_content());
示例4: content
protected function content($atts, $content = null)
{
$title = $width = $el_class = $output = $filter = $social_icon_type = $items = $team_member_link_class = $el_position = '';
extract(shortcode_atts(array('title' => '', 'item_columns' => '3', 'display_type' => 'standard', 'carousel' => 'no', "item_count" => '12', "custom_image_height" => '', "category" => '', 'pagination' => '', 'post_ids' => '', 'profile_link' => 'yes', 'ajax_overlay' => 'no', 'fullwidth' => 'no', 'gutters' => 'yes', 'order' => 'desc', 'order_by' => 'date', 'el_position' => '', 'width' => '1/1', 'el_class' => ''), $atts));
// CATEGORY SLUG MODIFICATION
if ($category == "All") {
$category = "all";
}
if ($category == "all") {
$category = '';
}
$category_slug = str_replace('_', '-', $category);
$contact_icon = apply_filters('sf_mail_icon', '<i class="ss-mail"></i>');
$phone_icon = apply_filters('sf_phone_icon', '<i class="ss-phone"></i>');
/* SIDEBAR CONFIG
================================================== */
global $sf_sidebar_config;
$sidebars = '';
if ($sf_sidebar_config == "left-sidebar" || $sf_sidebar_config == "right-sidebar") {
$sidebars = 'one-sidebar';
} else {
if ($sf_sidebar_config == "both-sidebars") {
$sidebars = 'both-sidebars';
} else {
$sidebars = 'no-sidebars';
}
}
global $post, $wp_query;
$paged = get_query_var('paged') ? get_query_var('paged') : 1;
$team_args = array('post_type' => 'team', 'post_status' => 'publish', 'paged' => $paged, 'team-category' => $category_slug, 'posts_per_page' => $item_count, 'order' => $order, 'orderby' => $order_by, 'ignore_sticky_posts' => 1);
if ($post_ids != "") {
$team_args['post__in'] = array($post_ids);
}
$team_members = new WP_Query($team_args);
$count = 0;
$image_width = 270;
$image_height = 270;
if ($item_columns == "1") {
$item_class = 'col-sm-12';
} else {
if ($item_columns == "2") {
$image_width = 540;
$image_height = 540;
$item_class = 'col-sm-6';
} else {
if ($item_columns == "3") {
$image_width = 360;
$image_height = 360;
$item_class = 'col-sm-4';
} else {
if ($item_columns == "5") {
$image_width = 360;
$image_height = 360;
$item_class = 'col-sm-sf-5';
} else {
$item_class = 'col-sm-3';
}
}
}
}
if ($custom_image_height != "") {
$image_height = $custom_image_height;
}
$list_class = 'display-type-' . $display_type;
if ($ajax_overlay == "yes") {
$team_member_link_class = 'team-member-ajax';
}
if ($gutters == "no") {
$list_class .= ' no-gutters';
}
if ($carousel == "yes") {
global $sf_carouselID;
if ($sf_carouselID == "") {
$sf_carouselID = 1;
} else {
$sf_carouselID++;
}
$item_class = 'carousel-item';
$items .= '<div class="team-carousel carousel-wrap"><div id="carousel-' . $sf_carouselID . '" class="team-members carousel-items ' . $list_class . ' clearfix" data-columns="' . $item_columns . '" data-auto="false">';
} else {
$items .= '<div class="team-members ' . $list_class . ' row clearfix">';
}
while ($team_members->have_posts()) {
$team_members->the_post();
$postID = $post->ID;
$member_name = get_the_title();
$member_position = sf_get_post_meta($postID, 'sf_team_member_position', true);
$custom_excerpt = sf_get_post_meta($postID, 'sf_custom_excerpt', true);
$pb_active = get_post_meta($postID, '_spb_js_status', true);
$member_link = get_permalink($postID);
$member_bio = "";
if ($pb_active == "true") {
if ($custom_excerpt != "") {
$member_bio = $custom_excerpt;
} else {
$member_bio = get_the_excerpt();
}
} else {
if ($custom_excerpt != "") {
$member_bio = sf_custom_excerpt($custom_excerpt, 1000);
//.........这里部分代码省略.........
示例5: sf_portfolio_items
function sf_portfolio_items($display_type, $columns, $show_title, $show_subtitle, $show_excerpt, $hover_show_excerpt, $excerpt_length, $item_count, $category, $exclude_categories, $pagination, $sidebars)
{
/* OUTPUT VARIABLE
================================================== */
$portfolio_items_output = "";
$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;
}
$portfolio_args = array('post_type' => 'portfolio', 'post_status' => 'publish', 'paged' => $paged, 'portfolio-category' => $category_slug, 'posts_per_page' => $item_count, 'tax_query' => array(array('taxonomy' => 'portfolio-category', 'field' => 'id', 'terms' => array($exclude_categories), 'operator' => 'NOT IN')));
$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 == "masonry-fw" || $display_type == "masonry-gallery-fw") {
$list_class .= 'masonry-items masonry-fw filterable-items col-' . $columns . ' row clearfix';
} else {
if ($display_type == "gallery") {
$list_class .= 'gallery-portfolio filterable-items col-' . $columns . ' row clearfix';
} else {
$list_class .= 'standard-portfolio filterable-items col-' . $columns . ' row clearfix';
}
}
}
/* ITEMS OUTPUT
================================================== */
$options = get_option('sf_dante_options');
$enable_portfolio_gallery = $options['enable_portfolio_gallery'];
$portfolio_items_output .= '<ul class="portfolio-items ' . $list_class . '">' . "\n";
while ($portfolio_items->have_posts()) {
$portfolio_items->the_post();
/* META VARIABLES
================================================== */
$thumb_image = $thumb_gallery = $video = $item_class = $link_config = '';
$thumb_width = 420;
$thumb_height = 315;
$video_height = 315;
$thumb_type = get_post_meta($post->ID, 'sf_thumbnail_type', true);
$thumb_image = rwmb_meta('sf_thumbnail_image', 'type=image&size=full');
$thumb_video = get_post_meta($post->ID, 'sf_thumbnail_video_url', true);
if ($columns == "2") {
$thumb_gallery = rwmb_meta('sf_thumbnail_gallery', 'type=image&size=thumb-image-twocol');
} else {
$thumb_gallery = rwmb_meta('sf_thumbnail_gallery', 'type=image&size=thumb-image');
}
$thumb_link_type = get_post_meta($post->ID, 'sf_thumbnail_link_type', true);
$thumb_link_url = 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 = get_post_meta($post->ID, 'sf_thumbnail_link_video_url', true);
$thumb_lightbox_video_url = sf_get_embed_src($thumb_lightbox_video_url);
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');
}
$thumb_lightbox_img_url = wp_get_attachment_url($thumb_lightbox_image, 'full');
$item_title = get_the_title();
$item_subtitle = get_post_meta($post->ID, 'sf_portfolio_subtitle', true);
$permalink = get_permalink();
$custom_excerpt = 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_terms = get_the_terms($post->ID, 'portfolio-category');
$term_slug = " ";
if (!empty($post_terms)) {
foreach ($post_terms as $post_term) {
$term_slug = $term_slug . $post_term->slug . ' ';
}
}
/* COLUMN VARIABLE CONFIG
================================================== */
$item_class = $item_icon = "";
if ($columns == "2") {
//.........这里部分代码省略.........
示例6: sf_swift_slider
function sf_swift_slider()
{
global $post, $wp_query;
$output = '';
$options = get_option('sf_dante_options');
$posts_slider_type = sf_get_post_meta($post->ID, 'sf_posts_slider_type', true);
$posts_category = sf_get_post_meta($post->ID, 'sf_posts_slider_category', true);
$portfolio_category = sf_get_post_meta($post->ID, 'sf_posts_slider_portfolio_category', true);
$count = sf_get_post_meta($post->ID, 'sf_posts_slider_count', true);
$args = array();
if ($posts_slider_type == "post") {
$slider_category = $posts_category;
if ($slider_category == "All") {
$slider_category = "all";
}
if ($slider_category == "all") {
$slider_category = '';
}
$category_slug = str_replace('_', '-', $slider_category);
$args = array('post_type' => 'post', 'post_status' => 'publish', 'category_name' => $category_slug, 'posts_per_page' => $count);
} else {
if ($posts_slider_type == "hybrid") {
$args = array('post_type' => array('post', 'portfolio'), 'post_status' => 'publish', 'posts_per_page' => $count);
} else {
$slider_category = $portfolio_category;
if ($slider_category == "All") {
$slider_category = "all";
}
if ($slider_category == "all") {
$slider_category = '';
}
$category_slug = str_replace('_', '-', $slider_category);
$args = array('post_type' => 'portfolio', 'post_status' => 'publish', 'portfolio-category' => $category_slug, 'posts_per_page' => $count, 'no_found_rows' => 1);
}
}
$slider_items = new WP_Query($args);
if ($slider_items->have_posts()) {
$output .= '<!--// SWIFT SLIDER //-->' . "\n";
$output .= '<div id="swift-slider" class="flexslider">' . "\n";
$output .= '<div class="swift-slider-loading"></div>' . "\n";
$output .= '<ul class="slides">' . "\n";
while ($slider_items->have_posts()) {
$slider_items->the_post();
$post_title = get_the_title();
$post_permalink = get_permalink();
$post_author = get_the_author_link();
$post_date = get_the_date();
$post_client = sf_get_post_meta($post->ID, 'sf_portfolio_client', true);
$post_categories = get_the_category_list(', ');
if ($posts_slider_type == "portfolio") {
$post_categories = get_the_term_list($post->ID, 'portfolio-category', '', ', ');
}
$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, 20);
} else {
$post_excerpt = sf_excerpt(20);
}
$posts_slider_image = rwmb_meta('sf_posts_slider_image', 'type=image&size=full');
$caption_position = sf_get_post_meta($post->ID, 'sf_caption_position', true);
$accent_color = get_option('accent_color', '#fb3c2d');
$secondary_accent_color = get_option('secondary_accent_color', '#2e2e36');
$secondary_accent_alt_color = get_option('secondary_accent_alt_color', '#ffffff');
$media_image_url = "";
foreach ($posts_slider_image as $detail_image) {
$media_image_url = $detail_image['url'];
break;
}
if (!$posts_slider_image) {
$posts_slider_image = get_post_thumbnail_id();
$media_image_url = wp_get_attachment_url($posts_slider_image, 'full');
}
if (!$caption_position) {
$caption_position = "caption-right";
}
$image = sf_aq_resize($media_image_url, 1920, NULL, true, false);
$output .= '<li>' . "\n";
$output .= '<div class="slide-caption-container">' . "\n";
if ($image) {
$output .= '<div class="flex-caption ' . $caption_position . '">' . "\n";
$output .= '<div class="flex-caption-details">' . "\n";
$output .= '<div class="caption-details-inner">' . "\n";
$output .= '<div class="details clearfix">' . "\n";
$output .= '<span class="date">' . $post_date . '</span>' . "\n";
if ($post_client != "") {
$output .= '<span class="item-client">' . __("Client: ", "swiftframework") . $post_client . '</span>' . "\n";
$output .= '<span class="item-categories">' . $post_categories . '</span>' . "\n";
} else {
$output .= '<span class="item-author">' . __("Posted by ", "swiftframework") . $post_author . '</span>' . "\n";
$output .= '<span class="item-categories">' . $post_categories . '</span>' . "\n";
}
$output .= '</div>';
if (comments_open()) {
$output .= '<div class="comment-chart chart" data-percent="1" data-count="' . $post_comments . '" data-barcolor="' . $secondary_accent_color . '"><span>0</span><i class="ss-chat"></i></div>' . "\n";
}
if (function_exists('lip_get_love_count')) {
$output .= '<div class="loveit-chart chart" data-percent="1" data-count="' . lip_get_love_count($post->ID) . '" data-barcolor="' . $accent_color . '"><span>0</span><i class="ss-heart"></i></div>' . "\n";
}
//.........这里部分代码省略.........
示例7: content
protected function content($atts, $content = null)
{
$options = get_option('sf_dante_options');
$title = $width = $excerpt_length = $item_class = $offset = $el_class = $output = $items = $el_position = '';
extract(shortcode_atts(array('title' => '', 'item_columns' => '3', "item_count" => '4', "category" => '', "offset" => 0, "posts_order" => 'ASC', "excerpt_length" => '20', 'el_position' => '', 'width' => '1/1', 'el_class' => ''), $atts));
// CATEGORY SLUG MODIFICATION
if ($category == "All") {
$category = "all";
}
if ($category == "all") {
$category = '';
}
$category_slug = str_replace('_', '-', $category);
global $post, $wp_query;
$args = array('post_type' => 'post', 'post_status' => 'publish', 'category_name' => $category_slug, 'posts_per_page' => $item_count, 'offset' => $offset, 'order' => $posts_order);
$blog_items = query_posts($args);
if ($item_columns == "1") {
$item_class = 'col-sm-12';
} else {
if ($item_columns == "2") {
$item_class = 'col-sm-6';
} else {
if ($item_columns == "3") {
$item_class = 'col-sm-4';
} else {
$item_class = 'col-sm-3';
}
}
}
if (have_posts()) {
$items .= '<ul class="recent-posts row clearfix">';
while (have_posts()) {
the_post();
$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');
}
$item_title = get_the_title();
$post_author = get_the_author_link();
$post_date = get_the_date();
$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);
}
$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 = "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 = "ss-link";
} else {
if ($thumb_link_type == "lightbox_thumb") {
$link_config = 'href="' . $thumb_img_url . '" class="view"';
$item_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'];
}
$link_config = 'href="' . $lightbox_image_url . '" class="view"';
$item_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 = "ss-video";
} else {
$link_config = 'href="' . $post_permalink . '" class="link-to-post"';
$item_icon = "ss-navigateright";
}
}
}
}
}
$items .= '<li itemscope class="recent-post ' . $item_class . ' clearfix">';
$items .= '<figure class="animated-overlay overlay-alt">';
if ($thumb_type == "video") {
$video = sf_video_embed($thumb_video, 270, 202);
//.........这里部分代码省略.........
示例8: content
protected function content($atts, $content = null)
{
$title = $width = $el_class = $output = $filter = $social_icon_type = $items = $el_position = '';
extract(shortcode_atts(array('title' => '', 'item_columns' => '3', "item_count" => '12', "category" => '', 'social_icon_type' => 'dark', 'pagination' => '', 'el_position' => '', 'width' => '1/1', 'el_class' => ''), $atts));
// CATEGORY SLUG MODIFICATION
if ($category == "All") {
$category = "all";
}
if ($category == "all") {
$category = '';
}
$category_slug = str_replace('_', '-', $category);
global $post, $wp_query;
$paged = get_query_var('paged') ? get_query_var('paged') : 1;
$team_args = array('post_type' => 'team', 'post_status' => 'publish', 'paged' => $paged, 'team-category' => $category_slug, 'posts_per_page' => $item_count, 'ignore_sticky_posts' => 1);
$team_members = new WP_Query($team_args);
$count = 0;
$image_width = 270;
$image_height = 270;
if ($item_columns == "1") {
$item_class = 'col-sm-12';
} else {
if ($item_columns == "2") {
$image_width = 540;
$image_height = 540;
$item_class = 'col-sm-6';
} else {
if ($item_columns == "3") {
$image_width = 360;
$image_height = 360;
$item_class = 'col-sm-4';
} else {
$item_class = 'col-sm-3';
}
}
}
$items .= '<ul class="team-members row clearfix">';
while ($team_members->have_posts()) {
$team_members->the_post();
$member_name = get_the_title();
$member_position = sf_get_post_meta($post->ID, 'sf_team_member_position', true);
$member_bio = get_the_content();
$custom_excerpt = sf_get_post_meta($post->ID, 'sf_custom_excerpt', true);
if ($custom_excerpt != "") {
$member_bio = sf_custom_excerpt($custom_excerpt, 1000);
}
$member_email = sf_get_post_meta($post->ID, 'sf_team_member_email', true);
$member_phone = sf_get_post_meta($post->ID, 'sf_team_member_phone_number', true);
$member_twitter = sf_get_post_meta($post->ID, 'sf_team_member_twitter', true);
$member_facebook = sf_get_post_meta($post->ID, 'sf_team_member_facebook', true);
$member_linkedin = sf_get_post_meta($post->ID, 'sf_team_member_linkedin', true);
$member_google_plus = sf_get_post_meta($post->ID, 'sf_team_member_google_plus', true);
$member_skype = sf_get_post_meta($post->ID, 'sf_team_member_skype', true);
$member_instagram = sf_get_post_meta($post->ID, 'sf_team_member_instagram', true);
$member_dribbble = sf_get_post_meta($post->ID, 'sf_team_member_dribbble', true);
$member_xing = sf_get_post_meta($post->ID, 'sf_team_member_xing', true);
$member_image = get_post_thumbnail_id();
$member_link = get_permalink();
$items .= '<li itemscope data-id="id-' . $count . '" class="clearfix team-member ' . $item_class . '">';
$img_url = wp_get_attachment_url($member_image, 'full');
$image = sf_aq_resize($img_url, $image_width, $image_height, true, false);
$items .= '<figure class="gallery-style">';
if ($image) {
$items .= '<a href="' . get_permalink() . '"><img itemprop="image" src="' . $image[0] . '" width="' . $image[1] . '" height="' . $image[2] . '" /></a>';
}
$items .= '<figcaption>';
$items .= '<h5 class="team-member-name">' . $member_name . '</h5>';
$items .= '<h5 class="team-member-position">' . $member_position . '</h5>';
if ($member_twitter || $member_facebook || $member_linkedin || $member_google_plus || $member_skype || $member_instagram || $member_dribbble || $member_xing != "") {
$items .= '<ul class="social-icons">';
if ($member_twitter) {
$items .= '<li class="twitter"><a href="http://www.twitter.com/' . $member_twitter . '" target="_blank"><i class="fa-twitter"></i><i class="fa-twitter"></i></a></li>';
}
if ($member_facebook) {
$items .= '<li class="facebook"><a href="' . $member_facebook . '" target="_blank"><i class="fa-facebook"></i><i class="fa-facebook"></i></a></li>';
}
if ($member_linkedin) {
$items .= '<li class="linkedin"><a href="' . $member_linkedin . '" target="_blank"><i class="fa-linkedin"></i><i class="fa-linkedin"></i></a></li>';
}
if ($member_google_plus) {
$items .= '<li class="googleplus"><a href="' . $member_google_plus . '" target="_blank"><i class="fa-google-plus"></i><i class="fa-google-plus"></i></a></li>';
}
if ($member_skype) {
$items .= '<li class="skype"><a href="skype:' . $member_skype . '" target="_blank"><i class="fa-skype"></i><i class="fa-skype"></i></a></li>';
}
if ($member_instagram) {
$items .= '<li class="instagram"><a href="' . $member_instagram . '" target="_blank"><i class="fa-instagram"></i><i class="fa-instagram"></i></a></li>';
}
if ($member_dribbble) {
$items .= '<li class="dribbble"><a href="http://www.dribbble.com/' . $member_dribbble . '" target="_blank"><i class="fa-dribbble"></i><i class="fa-dribbble"></i></a></li>';
}
if ($member_xing) {
$items .= '<li class="xing"><a href="' . $member_xing . '" target="_blank"><i class="fa-xing"></i><i class="fa-xing"></i></a></li>';
}
$items .= '</ul>';
}
$items .= '</figcaption>';
$items .= '</figure>';
$items .= '</li>';
$count++;
//.........这里部分代码省略.........
示例9: sf_directory_user_listings
function sf_directory_user_listings($user_id)
{
wp_reset_query();
$search_term = "";
$listing_output = "";
$excerpt_length = "";
$search_query_args = array('s' => $search_term, 'post_type' => 'directory', 'post_status' => 'publish', 'posts_per_page' => -1, 'suppress_filters' => false, 'author' => $user_id);
$search_query_args = http_build_query($search_query_args);
$search_results = get_posts($search_query_args);
foreach ($search_results as $result) {
$post_excerpt = $result->post_content;
if ($excerpt_length != '') {
if ($custom_excerpt != '') {
$post_excerpt = sf_custom_excerpt($custom_excerpt, $excerpt_length);
} else {
$post_excerpt = sf_excerpt($excerpt_length);
}
} else {
$post_excerpt = sf_excerpt(200);
}
$post_excerpt = $result->post_content;
$post_terms = get_the_terms($result->ID, 'directory-category');
$term_slug = " ";
$category_list_text = "";
if (!empty($post_terms)) {
foreach ($post_terms as $post_term) {
$term_slug = $term_slug . $post_term->slug . ' ';
$category_list_text .= $post_term->name . ' | ';
}
}
$category_list_text = rtrim($category_list_text, "| ");
$location_terms = get_the_terms($result->ID, 'directory-location');
$location_text = "";
if (!empty($location_terms)) {
foreach ($location_terms as $location_term) {
$location_text .= $location_term->name . ' | ';
}
$location_text = rtrim($location_text, "| ");
if ($category_list_text != '') {
$location_text = '| ' . $location_text;
}
}
$pin_img_url = wp_get_attachment_image_src(sf_get_post_meta($result->ID, 'sf_directory_map_pin', true), 'full');
$img_src = wp_get_attachment_image_src(get_post_thumbnail_id($result->ID), 'thumb-image');
$pin_logo_url = $pin_img_url[0];
$pin_thumbnail = $img_src[0];
$pin_link = esc_url(sf_get_post_meta($result->ID, 'sf_directory_pin_link', true));
$pin_link = esc_url(sf_get_post_meta($result->ID, 'sf_directory_pin_link', true));
$listing_output .= '<div class="directory-results container"><div class="directory-list-results">';
$listing_output .= '<div class="directory-item clearfix">';
// Item thumb if provided
if ($pin_thumbnail != "") {
$listing_output .= '<figure class="animated-overlay overlay-alt"><img itemprop="image" src="' . $pin_thumbnail . '" alt="' . $result->post_title . '"><a href="' . $pin_link . '" class="link-to-post"></a><div class="figcaption-wrap"></div><figcaption><div class="thumb-info"><h4>' . $result->post_title . '</h4></div></figcaption></figure>';
}
// Item details
$listing_output .= '<div class="directory-item-details"><h3>' . $result->post_title . '</h3><div class="item-meta">' . $category_list_text . $location_text . '</div><div class="excerpt" itemprop="description"><p>' . $post_excerpt . '</p> </div></div>';
$listing_output .= '</div>';
$listing_output .= '<a class="edit-listing" data-listing-id="' . $result->ID . '" href="#" target="_blank">Edit</a>';
$listing_output .= '<a class="delete-listing" data-listing-id="' . $result->ID . '" href="#" target="_blank">Delete</a>';
$listing_output .= '</div></div>';
}
//DELETE CONFIRMATION MODAL HTML
$listing_output .= '<div id="modal-from-dom" class="modal-delete-listing modal fade"><div class="modal-header"><h3>' . __("Delete Directory Listing", "swiftframework") . '</h3></div>';
$listing_output .= '<div class="modal-body"><p>' . __("You are about to delete this directory listing, this procedure is irreversible.", "swiftframework") . '</p><p>' . __("Do you want to proceed?", "swiftframework") . '</p></div>';
$listing_output .= '<div class="modal-footer"><a href="#" class="btn danger delete-listing-confirmation">' . __("Yes", "swiftframework") . '</a><a href="#" class="btn secondary cancel-delete-listing">' . __("No", "swiftframework") . '</a></div></div>';
echo $listing_output;
}
示例10: sf_get_recent_post_item
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', '');
//.........这里部分代码省略.........
示例11: content
protected function content($atts, $content = null)
{
$title = $show_hide = $width = $item_class = $el_class = $output = $filter = $items = $el_position = '';
extract(shortcode_atts(array('title' => '', "category" => 'all', 'excerpt_length' => '60', 'el_position' => '', 'width' => '1/1', 'el_class' => ''), $atts));
// CATEGORY SLUG MODIFICATION
if ($category == "All") {
$category = "all";
}
if ($category == "all") {
$category = '';
}
$category_slug = str_replace('_', '-', $category);
global $post, $wp_query, $sf_carouselID;
if ($sf_carouselID == "") {
$sf_carouselID = 1;
} else {
$sf_carouselID++;
}
$args = array('post_type' => 'team', 'post_status' => 'publish', 'team-category' => $category_slug, 'posts_per_page' => -1, 'ignore_sticky_posts' => 1, 'no_found_rows' => 1);
$team_members = query_posts($args);
$count = $columns = 0;
$sidebar_config = sf_get_post_meta(get_the_ID(), 'sf_sidebar_config', true);
if (is_singular('portfolio')) {
$sidebar_config = "no-sidebars";
}
if ($sidebar_config == "left-sidebar" || $sidebar_config == "right-sidebar") {
$item_class = 'span2';
} else {
if ($sidebar_config == "both-sidebars") {
$item_class = 'span-bs-quarter';
} else {
$item_class = 'span3';
}
}
if ($width == "1/4") {
$columns = 1;
} else {
if ($width == "1/2") {
$columns = 2;
} else {
if ($width == "3/4") {
$columns = 3;
} else {
$columns = 4;
}
}
}
$list_class = '';
if ($show_hide == "yes") {
$list_class = 'has-show-hide';
}
if (have_posts()) {
$items .= '<div class="carousel-overflow"><ul id="carousel-' . $sf_carouselID . '" class="team-members carousel-items ' . $list_class . ' clearfix" data-columns="' . $columns . '" data-auto="false">';
while (have_posts()) {
the_post();
$member_name = get_the_title();
$member_position = sf_get_post_meta($post->ID, 'sf_team_member_position', true);
$member_bio = sf_excerpt($excerpt_length);
$custom_excerpt = sf_get_post_meta($post->ID, 'sf_custom_excerpt', true);
if ($custom_excerpt != "") {
$member_bio = sf_custom_excerpt($custom_excerpt, 1000);
}
$member_twitter = sf_get_post_meta($post->ID, 'sf_team_member_twitter', true);
$member_facebook = sf_get_post_meta($post->ID, 'sf_team_member_facebook', true);
$member_linkedin = sf_get_post_meta($post->ID, 'sf_team_member_linkedin', true);
$member_google_plus = sf_get_post_meta($post->ID, 'sf_team_member_google_plus', true);
$member_skype = sf_get_post_meta($post->ID, 'sf_team_member_skype', true);
$member_instagram = sf_get_post_meta($post->ID, 'sf_team_member_instagram', true);
$member_dribbble = sf_get_post_meta($post->ID, 'sf_team_member_dribbble', true);
$member_image = get_post_thumbnail_id();
$items .= '<li itemscope data-id="id-' . $count . '" class="clearfix carousel-item team-member ' . $item_class . '">';
$img_url = wp_get_attachment_url($member_image, 'full');
$image = sf_aq_resize($img_url, 270, 270, true, false);
$items .= '<figure class="standard-style">';
if ($image) {
$items .= '<img itemprop="image" src="' . $image[0] . '" width="' . $image[1] . '" height="' . $image[2] . '" />';
}
if ($member_twitter != "" || $member_facebook != "" || $member_linkedin != "" || $member_google_plus != "" || $member_skype != "" || $member_instagram != "" || $member_dribbble != "") {
$items .= '<figcaption><span>' . __("Follow:", "swiftframework") . '</span><ul class="social-icons">';
if ($member_twitter != "") {
$items .= '<li class="twitter"><a href="http://www.twitter.com/' . $member_twitter . '" target="_blank"><i class="fa-twitter"></i><i class="fa-twitter"></i></a></li>';
}
if ($member_facebook != "") {
$items .= '<li class="facebook"><a href="' . $member_facebook . '" target="_blank"><i class="fa-facebook"></i><i class="fa-facebook"></i></a></li>';
}
if ($member_linkedin != "") {
$items .= '<li class="linkedin"><a href="' . $member_linkedin . '" target="_blank"><i class="fa-linkedin"></i><i class="fa-linkedin"></i></a></li>';
}
if ($member_google_plus != "") {
$items .= '<li class="googleplus"><a href="' . $member_google_plus . '" target="_blank"><i class="fa-google-plus"></i><i class="fa-google-plus"></i></a></li>';
}
if ($member_skype != "") {
$items .= '<li class="skype"><a href="skype:' . $member_skype . '" target="_blank"><i class="fa-skype"></i><i class="fa-skype"></i></a></li>';
}
if ($member_instagram != "") {
$items .= '<li class="instagram"><a href="' . $member_instagram . '" target="_blank"><i class="fa-instagram"></i><i class="fa-instagram"></i></a></li>';
}
if ($member_dribbble != "") {
$items .= '<li class="dribbble"><a href="http://www.dribbble.com/' . $member_dribbble . '" target="_blank"><i class="fa-dribbble"></i><i class="fa-dribbble"></i></a></li>';
}
//.........这里部分代码省略.........
示例12: sf_get_post_item
function sf_get_post_item($postID, $blog_type, $show_title = "yes", $show_excerpt = "yes", $show_details = "yes", $excerpt_length = "20", $content_output = "excerpt", $show_read_more = "no")
{
$post_item = $thumb_img_url = $image_id = "";
$options = get_option('sf_dante_options');
$single_author = $options['single_author'];
$remove_dates = false;
if (isset($options['remove_dates']) && $options['remove_dates'] == 1) {
$remove_dates = true;
}
global $post, $sf_sidebar_config;
$post_format = get_post_format($postID);
if ($post_format == "") {
$post_format = 'standard';
}
$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();
$custom_excerpt = sf_get_post_meta($postID, 'sf_custom_excerpt', true);
$post_excerpt = '';
if ($content_output == "excerpt") {
if ($custom_excerpt != '') {
$post_excerpt = sf_custom_excerpt($custom_excerpt, $excerpt_length);
} else {
if ($post_format == "quote") {
$post_excerpt = sf_get_the_content_with_formatting();
} else {
$post_excerpt = sf_excerpt($excerpt_length);
}
}
} else {
$post_excerpt = sf_get_the_content_with_formatting();
}
if ($post_format == "chat") {
$post_excerpt = sf_content(40);
} else {
if ($post_format == "audio") {
$post_excerpt = do_shortcode(get_the_content());
} else {
if ($post_format == "video") {
$content = get_the_content();
$content = apply_filters('the_content', $content);
$post_excerpt = $content;
} else {
if ($post_format == "link") {
$content = get_the_content();
$content = apply_filters('the_content', $content);
$post_excerpt = $content;
}
}
}
}
$post_item = $thumb_image = $thumb_width = $thumb_height = $bordered_thumb_width = $bordered_thumb_height = $video = $video_height = $bordered_video_height = $item_class = $link_config = $item_icon = $gallery_size = '';
if ($blog_type == "mini") {
if ($sf_sidebar_config == "no-sidebars") {
$thumb_width = 446;
$thumb_height = NULL;
$video_height = 335;
} else {
$thumb_width = 370;
$thumb_height = NULL;
$video_height = 260;
}
$gallery_size = 'thumb-image';
} else {
if ($blog_type == "masonry" || $blog_type == "masonry-fw") {
if ($sf_sidebar_config == "both-sidebars" || $blog_type == "masonry-fw") {
$item_class = "col-sm-3";
} else {
$item_class = "col-sm-4";
}
$thumb_width = 480;
$thumb_height = NULL;
$video_height = 360;
$gallery_size = 'thumb-image';
} else {
$thumb_width = 970;
$thumb_height = NULL;
$video_height = 728;
$gallery_size = 'blog-image';
}
}
$thumb_type = sf_get_post_meta($postID, 'sf_thumbnail_type', true);
$thumb_image = rwmb_meta('sf_thumbnail_image', 'type=image&size=full');
$thumb_video = sf_get_post_meta($postID, 'sf_thumbnail_video_url', true);
$thumb_gallery = rwmb_meta('sf_thumbnail_gallery', 'type=image&size=' . $gallery_size);
$thumb_link_type = sf_get_post_meta($postID, 'sf_thumbnail_link_type', true);
$thumb_link_url = sf_get_post_meta($postID, '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($postID, 'sf_thumbnail_link_video_url', true);
$thumb_lightbox_video_url = sf_get_embed_src($thumb_lightbox_video_url);
$image_id = 0;
foreach ($thumb_image as $detail_image) {
$image_id = $detail_image['ID'];
$thumb_img_url = $detail_image['url'];
break;
}
//.........这里部分代码省略.........
示例13: sf_galleries
function sf_galleries($display_type, $link_type, $fullwidth, $gutters, $columns, $show_title, $show_subtitle, $show_excerpt, $excerpt_length, $item_count, $category, $pagination, $sidebars, $hover_style)
{
/* OUTPUT VARIABLE
================================================== */
$gallery_items_output = "";
$count = 0;
/* CATEGORY SLUG MODIFICATION
================================================== */
if ($category == "All") {
$category = "all";
}
if ($category == "all") {
$category = '';
}
$category_slug = str_replace('_', '-', $category);
/* GALLERIES 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;
}
$galleries_args = array('post_type' => 'galleries', 'post_status' => 'publish', 'paged' => $paged, 'gallery-category' => $category_slug, 'posts_per_page' => $item_count);
$galleries_items = new WP_Query($galleries_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-galleries filterable-items col-' . $columns . ' row clearfix';
} else {
$list_class .= 'standard-galleries filterable-items col-' . $columns . ' row clearfix';
}
}
// Full width
if ($fullwidth == "yes") {
$list_class .= ' galleries-full-width';
}
// Gutters
if ($gutters == "no") {
$list_class .= ' no-gutters';
} else {
$list_class .= ' gutters';
}
// Thumb Type
if ($hover_style == "default" && function_exists('sf_get_thumb_type')) {
$list_class .= ' ' . sf_get_thumb_type();
} else {
$list_class .= ' thumbnail-' . $hover_style;
}
/* ITEMS OUTPUT
================================================== */
global $sf_options;
$gallery_items_output .= '<ul class="gallery-items ' . $list_class . '">' . "\n";
while ($galleries_items->have_posts()) {
$galleries_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_gallery_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);
}
$post_terms = get_the_terms($post->ID, 'gallery-category');
$term_slug = " ";
if (!empty($post_terms)) {
foreach ($post_terms as $post_term) {
$term_slug = $term_slug . $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 ";
}
}
//.........这里部分代码省略.........
示例14: sf_portfolio_thumbnail
//.........这里部分代码省略.........
$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);
$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 != "") {
$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 . ');"';
}
if ($port_hover_text_color != "") {
$port_hover_text_style = 'style="color: ' . $port_hover_text_color . ';"';
}
foreach ($thumb_image as $detail_image) {
$thumb_image_id = $detail_image['ID'];
$thumb_img_url = $detail_image['url'];
break;
}
if (!$thumb_image) {
$thumb_image = get_post_thumbnail_id();
$thumb_image_id = $thumb_image;
$thumb_img_url = wp_get_attachment_url($thumb_image, 'full');
}
$thumb_lightbox_img_url = wp_get_attachment_url($thumb_lightbox_image, 'full');
$image_alt = esc_attr(sf_get_post_meta($thumb_image_id, '_wp_attachment_image_alt', true));
$item_title = get_the_title();
$item_subtitle = sf_get_post_meta($post->ID, 'sf_portfolio_subtitle', true);
$permalink = get_permalink();
$item_link = sf_portfolio_item_link();
$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);
}
if ($display_type == "gallery" || $display_type == "masonry-gallery" || $display_type == "multi-size-masonry") {
$portfolio_thumb .= '<figure class="animated-overlay overlay-style">' . "\n";
} else {
$portfolio_thumb .= '<figure class="animated-overlay overlay-alt">' . "\n";
}
if ($thumb_type == "video") {
$video = sf_video_embed($thumb_video, $thumb_width, $video_height);
$portfolio_thumb .= '<div class="video-thumb">' . $video . '</div>';
} else {
if ($thumb_type == "slider") {
$portfolio_thumb .= '<div class="flexslider thumb-slider"><ul class="slides">' . "\n";
foreach ($thumb_gallery as $image) {
$portfolio_thumb .= "<li><a " . $item_link['config'] . "><img src='{$image['url']}' width='{$image['width']}' height='{$image['height']}' alt='{$image['alt']}' /></a></li>" . "\n";
}
$portfolio_thumb .= '</ul></div>' . "\n";
} else {
if ($thumb_type == "image" && $thumb_img_url == "") {
$thumb_img_url = "default";
}
$image = sf_aq_resize($thumb_img_url, $thumb_width, $thumb_height, true, false);
if ($image) {
$portfolio_thumb .= '<a ' . $item_link['config'] . '></a>';
if ($display_type == "multi-size-masonry") {
$portfolio_thumb .= '<div class="multi-masonry-img-wrap"><img itemprop="image" src="' . $image[0] . '" width="' . $image[1] . '" height="' . $image[2] . '" alt="' . $image_alt . '" /></div>' . "\n";
} else {
$portfolio_thumb .= '<img itemprop="image" src="' . $image[0] . '" width="' . $image[1] . '" height="' . $image[2] . '" alt="' . $image_alt . '" />' . "\n";