本文整理汇总了PHP中get_resized_image_output函数的典型用法代码示例。如果您正苦于以下问题:PHP get_resized_image_output函数的具体用法?PHP get_resized_image_output怎么用?PHP get_resized_image_output使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_resized_image_output函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: widget
function widget($args, $instance)
{
//defaults
$instance = wp_parse_args($instance, array("title" => "", "categories" => "", "count" => "", "limit" => "", "show_thumbnails" => "", "show_excerpt" => "", "thumb_width" => "", "thumb_height" => ""));
extract($args);
$title = !empty($instance['title']) ? apply_filters('widget_title', $instance['title']) : "";
$categories = !empty($instance['categories']) ? implode($instance['categories'], ',') : "";
$count = !empty($instance['count']) ? $instance['count'] : 5;
$limit = !empty($instance['limit']) ? $instance['limit'] : 100;
$show_thumbnails = !empty($instance['show_thumbnails']) ? $instance['show_thumbnails'] : "";
$show_excerpt = !empty($instance['show_excerpt']) ? $instance['show_excerpt'] : "";
$thumb_width = !empty($instance['thumb_width']) ? $instance['thumb_width'] : 260;
$thumb_height = !empty($instance['thumb_height']) ? $instance['thumb_height'] : 260;
$comment = "";
//remove aside and quote post formats from the list
$postargs = array('orderby' => 'comment_count', 'post_type' => 'post', 'showposts' => $count, 'cat' => $categories, 'nopaging' => 0, 'post_status' => 'publish', 'ignore_sticky_posts' => 1);
$post_query = new WP_Query($postargs);
$rt_posts = '';
if ($post_query->have_posts()) {
while ($post_query->have_posts()) {
$post_query->the_post();
$post_title = get_the_title();
$link = get_permalink();
$date = get_the_time('d M Y');
$comment_count = get_comment_count($post_query->post->ID);
$featured_image_id = get_post_thumbnail_id();
$get_the_excerpt = $show_excerpt ? '<p>' . wp_html_excerpt(get_the_excerpt(), $limit) . '...</p>' : "";
// Create thumbnail image
$thumbnail_image_output = !empty($featured_image_id) ? get_resized_image_output(array("image_url" => "", "image_id" => $featured_image_id, "w" => $thumb_width, "h" => $thumb_height, "crop" => 1, "class" => "post-thumb")) : "";
if (empty($thumbnail_image_output) || !empty($show_thumbnails)) {
$thumbnail_image_output = "";
}
if ($comment_count['approved'] > 0) {
if ($comment_count['approved'] > 1) {
$comments = $comment_count['approved'] . ' ' . __('Comments', 'rt_theme');
} else {
$comments = __('1 Comment', 'rt_theme');
}
$comment = ' | <span class="comment_number"><span class="icon-comment-empty"></span><a href="' . get_comments_link() . '" title="' . $comments . '" class="comment_link">' . $comment_count['approved'] . '</a></span>';
}
$rt_posts .= sprintf('
<div>
%1$s
<a class="title" href="%2$s" title="%3$s" rel="bookmark">%3$s</a>
<span class="meta">%4$s %6$s</span>
%5$s
</div>
', $thumbnail_image_output, $link, $post_title, get_the_date(), $get_the_excerpt, $comment);
}
wp_reset_postdata();
}
echo $before_widget;
if ($title) {
echo $before_title . $title . $after_title;
}
echo $rt_posts;
echo $after_widget;
}
示例2: widget
function widget($args, $instance)
{
extract($args);
$title = apply_filters('widget_title', $instance['title']);
$categories = empty($instance['categories']) ? $instance['categories'] : implode($instance['categories'], ',');
$count = empty($instance['count']) ? 5 : $instance['count'];
$limit = empty($instance['limit']) ? 100 : $instance['limit'];
$show_thumbnails = $instance['show_thumbnails'];
$show_excerpt = $instance['show_excerpt'];
$thumb_width = empty($instance['thumb_width']) ? 50 : $instance['thumb_width'];
$thumb_height = empty($instance['thumb_height']) ? 50 : $instance['thumb_height'];
$comment = "";
//remove aside and quote post formats from the list
$postargs = array('orderby' => 'comment_count', 'post_type' => 'post', 'showposts' => $count, 'cat' => $categories, 'nopaging' => 0, 'post_status' => 'publish', 'ignore_sticky_posts' => 1);
$post_query = new WP_Query($postargs);
$rt_posts = '<div class="recent_posts clearfix"><ul>';
if ($post_query->have_posts()) {
while ($post_query->have_posts()) {
$post_query->the_post();
$post_title = get_the_title();
$link = get_permalink();
$date = get_the_time('d M Y');
$comment_count = get_comment_count($post_query->post->ID);
$featured_image_id = get_post_thumbnail_id();
// Create thumbnail image
$thumbnail_image_output = !empty($featured_image_id) ? get_resized_image_output(array("image_url" => "", "image_id" => $featured_image_id, "w" => $thumb_width, "h" => $thumb_height, "crop" => 1, "class" => "recent-posts-thumb")) : "";
$rt_posts .= '<li class="clearfix">';
if ($thumbnail_image_output && !$show_thumbnails) {
$rt_posts .= $thumbnail_image_output;
}
if ($comment_count['approved'] > 0) {
if ($comment_count['approved'] > 1) {
$comments = $comment_count['approved'] . ' ' . __('Comments', 'rt_theme');
} else {
$comments = __('1 Comment', 'rt_theme');
}
$comment = ' <span class="comment_number"><span class="icon-comment-empty"></span><a href="' . get_comments_link() . '" title="' . $comments . '" class="comment_link">' . $comment_count['approved'] . '</a></span>';
}
$rt_posts .= '<span class="title"><a href="' . $link . '">' . $post_title . '</a></span>';
$rt_posts .= '<div class="widget-meta"><span class="date">' . $date . '</span> ' . $comment . '</div>';
$rt_posts .= $show_excerpt ? '' . wp_html_excerpt(get_the_excerpt(), $limit) . '...' . '<div class="space margin-b10"></div>' : "";
$rt_posts .= '</li>';
}
}
wp_reset_query();
$rt_posts .= '</ul></div>';
echo $before_widget;
if ($title) {
echo $before_title . $title . $after_title;
}
echo $rt_posts;
echo $after_widget;
}
示例3: extract
<?php
#
# rt-theme
# post content for standart post types in listing pages
#
global $rt_list_style, $more, $rt_global_post_values;
//extract global values
extract($rt_global_post_values);
if ($audio_usage_listing == "only_featured_image") {
// Create thumbnail image
$thumbnail_image_output = !empty($featured_image_id) ? get_resized_image_output(array("image_url" => "", "image_id" => $featured_image_id, "w" => $featured_image_width, "h" => $featured_image_height, "crop" => $crop)) : "";
// Tiny image thumbnail for lightbox gallery feature
$lightbox_thumbnail = !empty($featured_image_id) ? rt_vt_resize($featured_image_id, "", 75, 50, true) : rt_vt_resize($featured_image_id, "", 75, 50, true);
$lightbox_thumbnail = is_array($lightbox_thumbnail) ? $lightbox_thumbnail["url"] : "";
} else {
$thumbnail_image_output = "";
}
?>
<!-- blog box-->
<article class="blog_list loop" id="post-<?php
the_ID();
?>
">
<?php
if ($rt_list_style == "style1") {
?>
<section class="first_section">
示例4: is_array
//add the wp featured image to the array
// Values
$image = is_array($rt_gallery_images) && isset($rt_gallery_images[0]) ? rt_find_image_org_path($rt_gallery_images[0]) : "";
$title = get_the_title();
$permalink = get_permalink();
$short_desc = get_post_meta($post->ID, RT_COMMON_THEMESLUG . 'short_description', true);
$regular_price = get_post_meta($post->ID, RT_COMMON_THEMESLUG . 'price_regular', true);
$sale_price = get_post_meta($post->ID, RT_COMMON_THEMESLUG . 'sale_price', true);
//is crop active
$crop = get_option(RT_THEMESLUG . '_product_image_crop') ? "true" : "";
//image max height
$h = $crop ? get_option(RT_THEMESLUG . '_product_image_height') : 10000;
//Thumbnail dimensions
$w = rt_get_min_resize_size($rt_item_width);
// Resize Image
$image_output = get_resized_image_output(array("image_url" => trim($image), "image_id" => "", "w" => $w, "h" => $h, "crop" => $crop));
if (!empty($image_output)) {
?>
<!-- product image -->
<div class="featured_image">
<a href="<?php
echo $permalink;
?>
" title="<?php
echo $title;
?>
" rel="bookmark" ><?php
echo $image_output;
?>
</a>
</div>
示例5: while
?>
<?php
/* The loop */
?>
<?php
while (have_posts()) {
the_post();
?>
<?php
if (has_post_thumbnail() && !post_password_required()) {
// Create thumbnail image
$thumbnail_image_output = get_resized_image_output(array("image_url" => "", "image_id" => get_post_thumbnail_id(), "w" => 500, "h" => 100000, "crop" => ""));
?>
<div class="entry-thumbnail alignleft">
<?php
echo $thumbnail_image_output;
?>
<?php
echo '<div class="staff-single-media-links aligncenter">' . rt_staff_media_links(get_the_ID()) . '</div>';
?>
</div>
<?php
}
?>
示例6: widget
function widget($args, $instance)
{
extract($args);
$title = apply_filters('widget_title', $instance['title']);
$categories = empty($instance['categories']) ? $instance['categories'] : implode($instance['categories'], ',');
$count = empty($instance['count']) ? 5 : $instance['count'];
$limit = empty($instance['limit']) ? 100 : $instance['limit'];
$show_thumbnails = $instance['show_thumbnails'];
$show_excerpt = $instance['show_excerpt'];
$thumb_width = empty($instance['thumb_width']) ? 260 : $instance['thumb_width'];
$thumb_height = empty($instance['thumb_height']) ? 260 : $instance['thumb_height'];
//remove aside and quote post formats from the list
$postargs = array('tax_query' => array(array('operator' => 'NOT IN', 'taxonomy' => 'post_format', 'field' => 'slug', 'terms' => array('post-format-quote', 'post-format-aside'))), 'post_type' => 'post', 'showposts' => $count, 'cat' => $categories, 'nopaging' => 0, 'post_status' => 'publish', 'ignore_sticky_posts' => 1);
$post_query = new WP_Query($postargs);
$rt_posts = '<section class="latest-news-2 clearfix"><ul>';
if ($post_query->have_posts()) {
while ($post_query->have_posts()) {
$post_query->the_post();
$post_title = get_the_title();
$link = get_permalink();
$date = get_the_time('d M Y');
$comment_count = get_comment_count($post_query->post->ID);
$featured_image_id = get_post_thumbnail_id();
$get_the_excerpt = $show_excerpt ? '<p>' . wp_html_excerpt(get_the_excerpt(), $limit) . '...</p>' : "";
// Create thumbnail image
$thumbnail_image_output = !empty($featured_image_id) ? get_resized_image_output(array("image_url" => "", "image_id" => $featured_image_id, "w" => $thumb_width, "h" => $thumb_height, "crop" => 1, "class" => "-posts-thumb")) : "";
if (empty($thumbnail_image_output) || !empty($show_thumbnails)) {
$thumbnail_image_output = "";
}
if ($comment_count['approved'] > 0) {
if ($comment_count['approved'] > 1) {
$comments = $comment_count['approved'] . ' ' . __('Comments', 'rt_theme');
} else {
$comments = __('1 Comment', 'rt_theme');
}
$comment = ' <span class="comment_number"><span class="icon-comment-empty"></span><a href="' . get_comments_link() . '" title="' . $comments . '" class="comment_link">' . $comment_count['approved'] . '</a></span>';
}
$rt_posts .= '<li class="clearfix">';
$rt_posts .= sprintf('
<section>
<div class="date_box">
<span class="day">%1$s</span>
<span class="year">%2$s %3$s</span>
</div>
</section>
', get_the_time("d"), get_the_time("M"), get_the_time("y"));
$rt_posts .= sprintf('
<section>
%1$s
<a class="title" href="%2$s" title="%3$s" rel="bookmark">%3$s</a>
%4$s
</section>
', $thumbnail_image_output, $link, $post_title, $get_the_excerpt);
$rt_posts .= '</li>';
}
}
wp_reset_query();
$rt_posts .= '</ul></section>';
echo $before_widget;
if ($title) {
echo $before_title . $title . $after_title;
}
echo $rt_posts;
echo $after_widget;
}
示例7: rt_latest_news
/**
* Latest News Shortcode
* @param array $atts
* @param string $content
* @return html $output
*/
function rt_latest_news($atts = array(), $content = null)
{
global $rt_post_values, $rt_blog_list_atts;
//defaults
$atts = shortcode_atts(array("id" => "", "image_width" => 250, "image_height" => 250, "list_orderby" => "date", "list_order" => "DESC", "max_item" => 10, "categories" => "", "excerpt_length" => 100, "style" => 1, "show_dates" => false), $atts);
extract($atts);
//id attr
$id_attr = !empty($id) ? 'id="' . $id . '"' : "";
//create a post status array
$post_status = is_user_logged_in() ? array('private', 'publish') : "publish";
//general query
$args = array('post_status' => $post_status, 'post_type' => 'post', 'orderby' => $list_orderby, 'order' => $list_order, 'showposts' => $max_item);
if (!empty($categories)) {
$categories = is_array($categories) ? $categories : explode(",", rt_wpml_lang_object_ids($categories, "category"));
$args = array_merge($args, array('tax_query' => array(array('taxonomy' => 'category', 'field' => 'id', 'terms' => $categories, 'operator' => "IN"))));
}
$wp_query = new WP_Query($args);
$output = "";
//get posts
if ($wp_query->have_posts()) {
//the loop
while ($wp_query->have_posts()) {
$wp_query->the_post();
$post_title = get_the_title();
$link = get_permalink();
$date = get_the_time('d M Y');
$comment_count = get_comment_count($wp_query->post->ID);
$featured_image_id = get_post_thumbnail_id();
$get_the_excerpt = $excerpt_length > 0 ? '<p>' . wp_html_excerpt(get_the_excerpt(), $excerpt_length) . '...</p>' : "";
// Create thumbnail image
$thumbnail_image_output = !empty($featured_image_id) ? get_resized_image_output(array("image_url" => "", "image_id" => $featured_image_id, "w" => $image_width, "h" => $image_height, "crop" => "true", "class" => "posts-image")) : "";
if (empty($thumbnail_image_output) || !empty($show_thumbnails)) {
$thumbnail_image_output = "";
}
if ($style == 1) {
/**
* Output Style 1
*/
$output .= '<article>' . "\n";
$output .= sprintf('
<div class="date">
<span class="day">%1$s</span>
<span class="year">%2$s %3$s</span>
</div>
' . "\n", get_the_time("d"), get_the_time("M"), get_the_time("y"));
$output .= sprintf('
<div class="text">
<h5 class="clean_heading"><a class="title" href="%1$s" title="%2$s" rel="bookmark">%2$s</a></h5>
%3$s
</div>
' . "\n", $link, $post_title, $get_the_excerpt);
$output .= '</article>' . "\n";
} else {
/**
* Output Style 2
*/
$output .= '<article>' . "\n";
$output .= !empty($thumbnail_image_output) ? sprintf(' <figure>%1$s</figure> ' . "\n", $thumbnail_image_output) : "";
$date = !empty($show_dates) ? '<span class="date">' . get_the_date() . '</span>' : "";
$output .= sprintf('
<div class="text">
%3$s
<h5 class="clean_heading"><a class="title" href="%1$s" title="%2$s" rel="bookmark">%2$s</a></h5>
%4$s
</div>
' . "\n", $link, $post_title, $date, $get_the_excerpt);
$output .= '</article>' . "\n";
}
}
//reset post data for the new query
wp_reset_postdata();
}
//create holder html
$output = !empty($output) ? '<section class="latest_news clearfix style-' . $style . '">' . $output . '</section>' : "";
return $output;
}
示例8: rt_create_product_image_slider
function rt_create_product_image_slider($rt_gallery_images, $post_name)
{
//slider id
$slider_id = "slider-" . $post_name;
//is crop active
$crop = get_option(RT_THEMESLUG . '_single_product_image_crop') ? true : false;
//image dimensions for product image slider
$w = rt_get_min_resize_size(3);
$h = $crop ? get_option(RT_THEMESLUG . '_single_product_image_height') : 10000;
//image dimensions for product images slider's thumbnails navigation
/*
$t_w = rt_get_min_resize_size(3)/6;
$t_h = $crop ? $h/6 : $t_w;
*/
$t_w = 80;
$t_h = 80;
//create slides and thumbnails outputs
$slides_output = $thumbnails_output = $slider_js_output = $slider = "";
foreach ($rt_gallery_images as $image_url) {
// Resize Image
$image_output = rt_get_image_data(array("image_url" => trim($image_url), "image_id" => "", "w" => $w, "h" => $h, "crop" => $crop));
$thumbail_output = get_resized_image_output(array("image_url" => trim($image_url), "image_id" => "", "w" => $t_w, "h" => $t_h, "crop" => true));
//create lightbox link
$lightbox_link = rt_create_lightbox_link(array('class' => 'icon-zoom-in single lightbox_', 'href' => $image_url, 'title' => __('Enlarge Image', 'rt_theme'), 'data_group' => 'group_product_slider', 'data_title' => $image_output["image_title"], 'data_description' => $image_output["image_caption"], 'data_thumbnail' => $image_output["thumbnail_url"], 'echo' => false));
if (count($rt_gallery_images) > 1) {
$slides_output .= sprintf('
<li>
<div class="imgeffect">
%s
<img src="%s" alt="%s">
</div>
</li>
', $lightbox_link, $image_output["thumbnail_url"], $image_output["image_alternative_text"]);
$thumbnails_output .= sprintf('
<li>%s</li>
', $thumbail_output);
} else {
$slides_output .= sprintf('
<div class="imgeffect">
%s
<img src="%s" alt="%s">
</div>
', $lightbox_link, $image_output["thumbnail_url"], $image_output["image_alternative_text"]);
}
}
//create thumbnail navigation output
if (count($rt_gallery_images) > 1) {
$thumbnail_navigation = sprintf('
<!-- slider thumbnails -->
<div id="%s_carousel" class="flexslider slider-carousel margin-t10">
<div class="flex-nav-container carousel"></div><!-- slider navigation buttons -->
<ul class="slides">
%s
</ul>
</div>
', $slider_id, $thumbnails_output);
}
//create js output
if (count($rt_gallery_images) > 1) {
$slider_js_output = sprintf('
<script type="text/javascript">
/* <![CDATA[ */
// Call flex slider for product image carousel
jQuery(window).load(function() {
jQuery("#%1$s_carousel").flexslider({
animation: "slide",
controlNav: false,
itemWidth: %2$s,
itemMargin: 5,
animationLoop: false,
slideshow: true,
slideshowSpeed:2000, // slider show speed
controlsContainer: "#%1$s_carousel .flex-nav-container",
asNavFor: "#%1$s", // slider ID
prevText: "←",
nextText: "→"
});
jQuery("#%1$s").flexslider({
animation: "slide",
controlNav: false,
animationLoop: false,
slideshowSpeed:8000, // carousel show speed
slideshow: true,
smoothHeight: true,
directionNav: false,
sync: "#%1$s_carousel", // carousel ID - thumbnail holder div
});
});
/* ]]> */
</script>
', $slider_id, $t_w);
}
//create slider output
if (count($rt_gallery_images) > 1) {
$slider = sprintf('
%s
//.........这里部分代码省略.........
示例9: isset
<?php
#
# rt-theme
# post content for standart post types in carousels
#
global $rt_item_width, $rt_crop, $rt_display_excerpts, $rt_column_layout, $rt_limit_chars;
//max width
$rt_item_width_for_resize = isset($rt_column_layout) && is_numeric($rt_column_layout) && $rt_column_layout > $rt_item_width ? $rt_column_layout : $rt_item_width;
$w = rt_get_min_resize_size($rt_item_width_for_resize);
//max height
$h = $rt_crop ? $w / 2 : 10000;
//featured_image_id
$featured_image_id = get_post_thumbnail_id();
// Create thumbnail image
$thumbnail_image_output = !empty($featured_image_id) ? get_resized_image_output(array("image_url" => "", "image_id" => $featured_image_id, "w" => $w, "h" => $h, "crop" => $rt_crop)) : "";
//the holder class for featured iamge and date
$holder_class = !empty($thumbnail_image_output) ? "featured-image" : "meta";
?>
<div class="<?php
echo $holder_class;
?>
">
<span class="date"><?php
the_time(get_option(RT_THEMESLUG . "_date_format"));
?>
</span>
<?php
示例10: get_post_meta
$remove_link = get_post_meta($post->ID, RT_COMMON_THEMESLUG . '_portf_no_detail', true);
$custom_thumb = get_post_meta($post->ID, RT_COMMON_THEMESLUG . '_portfolio_thumb_image', true);
$disable_lightbox = get_post_meta($post->ID, RT_COMMON_THEMESLUG . '_disable_lightbox', true);
$external_link = get_post_meta($post->ID, RT_COMMON_THEMESLUG . '_external_link', true);
$permalink = !empty($external_link) ? $external_link : get_permalink();
$open_in_new_tab = get_post_meta($post->ID, RT_COMMON_THEMESLUG . '_open_in_new_tab', true);
$target = !empty($open_in_new_tab) ? '_blank' : "_self";
//link target
//is crop active
$rt_crop = get_option(RT_THEMESLUG . '_portfolio_image_crop') ? "true" : "";
//image max height
$h = $rt_crop ? get_option(RT_THEMESLUG . '_portfolio_image_height') : 10000;
//Thumbnail dimensions
$w = rt_get_min_resize_size($rt_item_width);
// Create thumbnail image
$thumbnail_image_output = !empty($custom_thumb) ? get_resized_image_output(array("image_url" => trim($custom_thumb), "image_id" => "", "w" => $w, "h" => $h, "crop" => $rt_crop)) : get_resized_image_output(array("image_url" => trim($image), "image_id" => "", "w" => $w, "h" => $h, "crop" => $rt_crop));
// Tiny image thumbnail for lightbox gallery feature
$lightbox_thumbnail = !empty($custom_thumb) ? rt_vt_resize('', $custom_thumb, 75, 50, true) : rt_vt_resize('', $image, 75, 50, true);
$lightbox_thumbnail = is_array($lightbox_thumbnail) ? $lightbox_thumbnail["url"] : $image;
$single_link_icon = $permalink && !$remove_link && !$disable_lightbox ? "" : "single";
?>
<?php
/*
*
* CONTENT FOR CATEOGORIES OR OTHER PORTFOLIO LISTS
*
*/
?>
示例11: rt_v_media_box
function rt_v_media_box($atts, $content = null)
{
global $rt_vc_image_style, $rt_vc_image_align, $rt_bw_filter;
/*
[v_media_box
image=""
title=""
link=""
link_target=""
][/v_media_box]
*/
//defaults
extract(shortcode_atts(array("image" => "", "title" => "", "link" => "", "link_target" => "_self"), $atts));
//link target
$link_target = !empty($link_target) ? $link_target : '_self';
// Thumbnail width & height
$h = $w = 460;
// Get image data
$image_args = array("image_url" => $image, "image_id" => "", "w" => $w, "h" => $h, "crop" => "true", "class" => "aligncenter");
//image output
$image_output = get_resized_image_output($image_args);
//add links to the featured image
$image_output = !empty($link) ? '<a href="' . $link . '" title="' . sanitize_text_field($title) . '" target="' . $link_target . '">' . $image_output . '</a>' : $image_output;
//b/w filter
$bw_filter = $rt_bw_filter ? "bw_filter" : "";
//image section
$image_section = sprintf('<div class="chanied_media_holder image"><div class="featured_image_holder %1$s %3$s">%2$s</div></div>', $rt_vc_image_style, $image_output, $bw_filter);
//title with link
$title = !empty($link) ? '<a href="' . $link . '" title="' . sanitize_text_field($title) . '" target="' . $link_target . '">' . $title . '</a>' : $title;
//title output
$title_output = !empty($title) ? '<h3 class="featured_article_title">' . $title . '</h3>' : "";
//content section
$content_section = sprintf('<div class="chanied_content_holder"> %1$s %2$s</div>', $title_output, do_shortcode($content));
//output
$output = sprintf('<li data-rt-animate="animate" data-rt-animation-type="fadeInDown">%1$s %2$s</li>', $image_section, $content_section);
return $output;
}
示例12: rt_get_product_loop_post_values
/**
* Get post values for loops
* gets all data of a portfolio item including metas
*
* @param array $post
* @param array $atts [atts of rt_product_post_loop function]
* @return array
*/
function rt_get_product_loop_post_values($post = array(), $atts = array())
{
extract($atts);
//featured image
$featured_image_id = get_post_thumbnail_id();
$featured_image_url = !empty($featured_image_id) ? wp_get_attachment_image_src($featured_image_id, "full") : "";
$featured_image_url = is_array($featured_image_url) ? $featured_image_url[0] : "";
/*
//custom thumbnail max height & crop settings for this post
$this_featured_image_settings = get_post_meta( $post->ID, RT_COMMON_THEMESLUG.'_featured_image_settings', true);
$featured_image_max_height = $this_featured_image_settings == "new" ? get_post_meta( $post->ID, RT_COMMON_THEMESLUG.'_portfolio_image_height', true) : $featured_image_max_height;
$featured_image_crop = $this_featured_image_settings == "new" ? get_post_meta( $post->ID, RT_COMMON_THEMESLUG.'_portfolio_image_crop', true) : $featured_image_crop;
*/
if ($featured_image_resize !== "false") {
// thumbnail min width
$w = !empty($featured_image_max_width) ? $featured_image_max_width : rt_get_min_resize_size($list_layout);
// thumbnail max height
$h = !empty($featured_image_max_height) ? $featured_image_max_height : 10000;
//thumbnail output
$thumbnail_image_output = !empty($featured_image_id) ? get_resized_image_output(array("image_url" => "", "image_id" => $featured_image_id, "w" => $w, "h" => $h, "crop" => $featured_image_crop)) : "";
} else {
//thumbnail output
$thumbnail_image_output = !empty($featured_image_id) ? rt_get_image_output(array("image_url" => "", "image_id" => $featured_image_id)) : "";
}
//permalink
$permalink = get_permalink();
//create global values array
$rt_product_post_values = array("title" => get_the_title(), "permalink" => $permalink, "featured_image_id" => $featured_image_id, "featured_image_url" => $featured_image_url, "regular_price" => get_post_meta($post->ID, RT_COMMON_THEMESLUG . 'price_regular', true), "sale_price" => get_post_meta($post->ID, RT_COMMON_THEMESLUG . 'sale_price', true), "short_desc" => get_post_meta($post->ID, RT_COMMON_THEMESLUG . 'short_description', true), "thumbnail_image_output" => $thumbnail_image_output);
return $rt_product_post_values;
}
示例13: rt_woocommerce_template_loop_product_thumbnail
function rt_woocommerce_template_loop_product_thumbnail()
{
global $post, $woocommerce, $woo_product_layout, $rt_title, $product;
$image = has_post_thumbnail($post->ID) ? get_post_thumbnail_id($post->ID) : "";
//is crop active
$crop = get_option(RT_THEMESLUG . '_woo_product_image_crop') ? "true" : "";
//image max height
$h = $crop ? get_option(RT_THEMESLUG . '_woo_product_image_height') : 10000;
//Thumbnail dimensions
$w = rt_get_min_resize_size($woo_product_layout);
// Resize Image
$image_output = get_resized_image_output(array("image_url" => "", "image_id" => $image, "w" => $w, "h" => $h, "crop" => $crop));
if (!empty($image_output)) {
if (!get_option(RT_THEMESLUG . "_hide_embedded_cart_button")) {
echo '<!-- product image --><div class="featured_image"><div class="imgeffect"> ';
echo do_action("rt_woocommerce_template_loop_add_to_cart");
echo $image_output;
echo '</div></div>';
} else {
echo '<!-- product image --><div class="featured_image">';
echo '<a href="' . get_permalink() . '">' . $image_output . '</a>';
echo '</div>';
}
}
}
示例14: get_post_meta
$remove_link = get_post_meta($post->ID, RT_COMMON_THEMESLUG . '_portf_no_detail', true);
$custom_thumb = get_post_meta($post->ID, RT_COMMON_THEMESLUG . '_portfolio_thumb_image', true);
$disable_lightbox = get_post_meta($post->ID, RT_COMMON_THEMESLUG . '_disable_lightbox', true);
$external_link = get_post_meta($post->ID, RT_COMMON_THEMESLUG . '_external_link', true);
$permalink = !empty($external_link) ? $external_link : get_permalink();
$open_in_new_tab = get_post_meta($post->ID, RT_COMMON_THEMESLUG . '_open_in_new_tab', true);
$target = !empty($open_in_new_tab) ? '_blank' : "_self";
//link target
//is crop active
$rt_crop = get_option(RT_THEMESLUG . '_portfolio_image_crop') ? "true" : "";
//image max height
$h = $rt_crop ? get_option(RT_THEMESLUG . '_portfolio_image_height') : 10000;
//Thumbnail dimensions
$w = rt_get_min_resize_size($rt_item_width);
//Thumbnail image output
$image_output = !empty($image) ? get_resized_image_output(array("image_url" => trim($image), "image_id" => "", "w" => $w, "h" => $h, "crop" => $rt_crop)) : "";
//video image thumbnail for lightbox
$audio_image_thumbnail = !empty($image) ? rt_vt_resize('', $image, 75, 50, true) : "";
$audio_image_thumbnail = is_array($audio_image_thumbnail) ? $audio_image_thumbnail["url"] : $image;
//single icons
$single_action_icon = !$permalink || $remove_link ? "single" : "";
$single_link_icon = !empty($disable_lightbox) ? "single" : "";
?>
<?php
/*
*