本文整理匯總了PHP中ui::thumbIt方法的典型用法代碼示例。如果您正苦於以下問題:PHP ui::thumbIt方法的具體用法?PHP ui::thumbIt怎麽用?PHP ui::thumbIt使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ui
的用法示例。
在下文中一共展示了ui::thumbIt方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: widget
function widget($args, $instance)
{
extract($args);
/* User-selected settings. */
$title = apply_filters('widget_title', $instance['title']);
$category = $instance['category'];
$show_count = $instance['show_count'];
$show_date = $instance['show_date'] ? true : false;
$show_thumb = $instance['show_thumb'] ? true : false;
$show_excerpt = $instance['show_excerpt'] ? true : false;
$excerpt_length = $instance['excerpt_length'];
$show_title = $instance['hide_title'] ? false : true;
/* Before widget (defined by themes). */
echo $before_widget;
/* Title of widget (before and after defined by themes). */
if ($title) {
echo $before_title . $title . $after_title;
}
echo '<ul class="feature-posts-list">';
$query_opts = apply_filters('wpzoom_query', array('posts_per_page' => $show_count, 'post_type' => 'post'));
if ($category) {
$query_opts['cat'] = $category;
}
query_posts($query_opts);
if (have_posts()) {
while (have_posts()) {
the_post();
echo '<li>';
if ($show_thumb && has_post_thumbnail()) {
echo '<a href="' . get_permalink() . '"><img src="' . ui::thumbIt(absint(get_post_thumbnail_id()), absint($instance['thumb_width']), absint($instance['thumb_height'])) . '" height="' . $instance['thumb_height'] . '" width="' . $instance['thumb_width'] . '"></a>';
}
if ($show_title) {
echo '<a href="' . get_permalink() . '">' . get_the_title() . '</a> <br />';
}
if ($show_date) {
echo '<small>' . get_the_date() . '</small> <br />';
}
if ($show_excerpt) {
$the_excerpt = get_the_excerpt();
// cut to character limit
$the_excerpt = substr($the_excerpt, 0, $excerpt_length);
// cut to last space
$the_excerpt = substr($the_excerpt, 0, strrpos($the_excerpt, ' '));
echo '<span class="post-excerpt">' . $the_excerpt . '</span>';
}
echo '<div class="clear"></div></li>';
}
} else {
}
//Reset query_posts
wp_reset_query();
echo '</ul><div class="clear"></div>';
/* After widget (defined by themes). */
echo $after_widget;
}