本文整理汇总了PHP中string_limit_words函数的典型用法代码示例。如果您正苦于以下问题:PHP string_limit_words函数的具体用法?PHP string_limit_words怎么用?PHP string_limit_words使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了string_limit_words函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: create_excerpt
function create_excerpt($str='', $word_limit=15) {
$str = trim(strip_tags($str));
$beg_count = strlen($str);
$str = string_limit_words($str, $word_limit);
$str = str_replace("\n", ' ', $str);
$str = str_replace("\r", '', $str);
$str = str_replace("\t", ' ', $str);
if (strlen($str) < $beg_count) $str .= ' ...';
return $str;
}
开发者ID:riseofthetigers,项目名称:scalar,代码行数:12,代码来源:html_to_rdf_proxy.php
示例2: the_excerpt_max_words
function the_excerpt_max_words($word_limit, $post = '', $echo = true)
{
if ($post) {
$excerpt = wp_strip_all_tags(get_the_excerpt_here($post->ID));
} else {
$excerpt = get_the_excerpt();
}
$result = string_limit_words($excerpt, $word_limit);
if ($echo) {
echo $result;
}
return $result;
}
开发者ID:mynein,项目名称:myne,代码行数:13,代码来源:excerpt.php
示例3: product
public function product($id)
{
$data['storeCategory'] = $this->cart_model->get_categories();
$product = $this->product_model->getProduct($id);
if (!empty($product['productData'])) {
$data['product'] = $product;
} else {
redirect("store");
}
$data['productAttribute'] = $this->product_model->getProductAttribute($id);
$data['pageTitle'] = $data['product']['productData']->name;
$data['pageDescription'] = string_limit_words($data['product']['productData']->description, 30);
$data['productGallery'] = $this->product_model->getProductGallery($id);
$this->load->view('productView', $data);
}
开发者ID:reesretuta,项目名称:beauty-mx,代码行数:15,代码来源:cart.php
示例4: aione_list_comments_shortcode
function aione_list_comments_shortcode($atts)
{
// Attributes
extract(shortcode_atts(array('count' => '', 'id' => '', 'class' => ''), $atts));
global $theme_options, $post;
$output = "";
$number = $count;
global $wpdb;
$recent_comments = "SELECT DISTINCT ID, post_title, post_password, comment_ID, comment_post_ID, comment_author, comment_author_email, comment_date_gmt, comment_approved, comment_type, comment_author_url, SUBSTRING(comment_content,1,110) AS com_excerpt FROM {$wpdb->comments} LEFT OUTER JOIN {$wpdb->posts} ON ({$wpdb->comments}.comment_post_ID = {$wpdb->posts}.ID) WHERE comment_approved = '1' AND comment_type = '' AND post_password = '' ORDER BY comment_date_gmt DESC LIMIT {$number}";
$the_comments = $wpdb->get_results($recent_comments);
if ($the_comments) {
$output .= '<ul class="list-posts resent-comments">';
foreach ($the_comments as $comment) {
$output .= '<li>';
$output .= '<div class="post-image">';
$output .= '<a>';
$output .= get_avatar($comment, '52');
$output .= '</a>';
$output .= '</div>';
$output .= '<div class="post-holder">';
$output .= strip_tags($comment->comment_author) . ' says:';
$output .= '<div class="post-meta">';
$output .= '<a class="comment-text-side" href="' . get_permalink($comment->ID) . '#comment-' . $comment->comment_ID . '" title="' . strip_tags($comment->comment_author) . ' on ' . $comment->post_title . '">';
$output .= string_limit_words(strip_tags($comment->com_excerpt), 12);
$output .= '...</a>';
$output .= '</div>';
$output .= '</div>';
$output .= '<div class="aione-clearfix"></div>';
$output .= '</li>';
}
$output .= '</ul>';
} else {
$output .= '<h5 class="font-size-16 aligncenter">No Comments Available.</h5>';
}
return $output;
}
开发者ID:sgssandhu,项目名称:aione-tools,代码行数:36,代码来源:posts.php
示例5: string_limit_words
$astpagecontent = 0;
}
}
echo '<!-- astpagecontent=' . $astpagecontent . ' -->';
if ($reg_requirement == 1) {
$showpagecontent = 0;
} else {
if ($astpagecontent === 0) {
$showpagecontent = 0;
} else {
$showpagecontent = 1;
}
}
}
if ($showpagecontent == 0) {
echo string_limit_words(get_the_excerpt(), 55) . '...</br>';
?>
<div style="border:#CCCCCC solid 1px; padding:10px;">
<form action="<?php
echo get_option('home');
?>
/wp-login.php?wpe-login=esminc" method="post">
<p><strong>Free registration required to view this resource.</strong><br />
<br />
<a href="<?php
echo get_option('home');
?>
/registration/?action=register&redirect_to=<?php
echo urlencode(get_permalink());
if (defined($_GET['astc'])) {
开发者ID:esm-erika,项目名称:eschoolnews,代码行数:31,代码来源:single-staff.php
示例6: the_title
?>
"><?php
the_title();
?>
</a></p>
<div class="meta">
<?php
the_author_posts_link();
?>
| <?php
the_time(get_option('date_format'));
?>
</div>
<p><?php
$excerpt = get_the_excerpt();
echo string_limit_words($excerpt, 20);
?>
</p>
</div>
<?php
}
?>
<?php
get_template_part('bot-nav');
?>
</div> <!-- end sitemap-wide div -->
</div> <!-- end entry div -->
开发者ID:erik1015,项目名称:WP-Visual-Theme,代码行数:30,代码来源:sitemap.php
示例7: comments_popup_link
comments_popup_link('0', '1', '%');
_e(" Comments", "Creativo");
?>
</li>
<?php
}
?>
</ul>
<?php
}
?>
<div class="post-content">
<?php
if ($data['post_content'] != 'Full Content') {
echo string_limit_words(get_the_excerpt(), $data['post_excerpt_length'] ? $data['post_excerpt_length'] : 30) . '...';
} else {
the_content();
}
?>
</div>
<?php
if ($data['show_view_more']) {
?>
<div class="post-atts archive">
<?php
if ($data['show_view_more']) {
?>
<a href="<?php
the_permalink();
开发者ID:AlchemyMomentum,项目名称:public_html,代码行数:31,代码来源:index-style-masonry.php
示例8: header
}
if ($status == '') {
$status = 1;
}
if (empty($message)) {
if (updatePage($id, $name, $content, $slug, $seotitle, $seodescrition, $seokeyword, $status, $mysqli) == true) {
header("Location: ../page.php");
exit;
} else {
$message = '<div class="alert alert-danger">Invalid!</div>';
}
}
} else {
$name = $_POST["name"];
$content = $_POST["content"];
$slug = string_limit_words($name);
// First 6 words
$seotitle = $_POST["seotitle"];
$seodescrition = $_POST["seodescrition"];
$seokeyword = $_POST["seokeyword"];
$status = $_POST["status"];
if (empty($name)) {
$message .= 'Enter your page name<br>';
}
if (empty($content)) {
$message .= 'Enter your page content<br>';
}
if ($status == '') {
$status = 1;
}
if (empty($message)) {
开发者ID:jayantisolanki,项目名称:cms,代码行数:31,代码来源:page_action.php
示例9: widget
//.........这里部分代码省略.........
" title="<?php
_e("Permanent Link to", "solostream");
?>
<?php
the_title();
?>
"><img class="thumbnail" src="<?php
echo $solostream_img['url'];
?>
" alt="<?php
the_title();
?>
" title="<?php
the_title();
?>
" /></a>
<?php
} else {
?>
<a href="<?php
the_permalink();
?>
" rel="<?php
_e("bookmark", "solostream");
?>
" title="<?php
_e("Permanent Link to", "solostream");
?>
<?php
the_title();
?>
"><img class="thumbnail <?php
echo $instance['image_alignment'];
?>
" src="<?php
echo $solostream_img['url'];
?>
" alt="<?php
the_title();
?>
" title="<?php
the_title();
?>
" /></a>
<?php
}
}
?>
<?php
}
?>
<?php
if (!empty($instance['show_content'])) {
?>
<p>
<?php
$excerpt = get_the_excerpt();
echo string_limit_words($excerpt, $instance['content_limit']);
?>
<?php
if (!empty($instance['more_text'])) {
?>
<a class="more-link" href="<?php
the_permalink();
?>
" rel="<?php
_e("bookmark", "solostream");
?>
" title="<?php
_e("Permanent Link to", "solostream");
?>
<?php
the_title();
?>
"><?php
echo esc_html($instance['more_text']);
?>
</a>
<?php
}
?>
</p>
<?php
}
?>
</div>
<?php
}
}
echo $after_widget;
wp_reset_query();
}
开发者ID:EasterAndJay,项目名称:tamichelew.com,代码行数:101,代码来源:theme-widgets.php
示例10: widget
/**
*
* Outputs the HTML code of this widget.
*
* @param array An array of standard parameters for widgets in this theme
* @param array An array of settings for this widget instance
* @return void
*
**/
function widget($args, $instance)
{
$cache = wp_cache_get('widget_dp_recent_post', 'widget');
if (!is_array($cache)) {
$cache = array();
}
if (!isset($args['widget_id'])) {
$args['widget_id'] = null;
}
if (isset($cache[$args['widget_id']])) {
echo $cache[$args['widget_id']];
return;
}
ob_start();
//
extract($args, EXTR_SKIP);
//
$title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base);
$post_cat = empty($instance['post_cat']) ? '' : $instance['post_cat'];
$show_num = empty($instance['$show_num']) ? '' : $instance['$show_num'];
$word_limit = empty($instance['$word_limit']) ? '' : $instance['$word_limit'];
$thumb_width = empty($instance['$thumb_width']) ? '' : $instance['$thumb_width'];
$show_thumb = empty($instance['$show_thumb']) ? 'true' : $instance['$show_thumb'];
$show_title = empty($instance['$show_title']) ? 'true' : $instance['$show_title'];
$show_date = empty($instance['$show_date']) ? 'true' : $instance['$show_date'];
if ($thumb_width == "") {
$thumb_width = '70';
}
//
echo $before_widget;
echo $before_title;
echo $title;
echo $after_title;
//
$custom_posts = get_posts('showposts=' . $show_num . '&cat=' . get_cat_ID($post_cat));
if (!empty($custom_posts)) {
echo "<div class='dp-recent-post-widget'>";
foreach ($custom_posts as $custom_post) {
?>
<div class="recent-post-widget">
<?php
$thumbnail_id = get_post_thumbnail_id($custom_post->ID);
$thumbnail = wp_get_attachment_image_src($thumbnail_id);
$alt_text = get_post_meta($thumbnail_id, '_wp_attachment_image_alt', true);
if (!empty($thumbnail) && $show_thumb == 'true') {
?>
<div class="thumbnail">
<a href="<?php
echo get_permalink($custom_post->ID);
?>
">
<?php
echo '<img width="' . $thumb_width . '" src="' . $thumbnail[0] . '" alt="' . $alt_text . '"/>';
?>
</a>
</div>
<?php
}
?>
<div class="content">
<?php
if ($show_title == 'true') {
?>
<h4><a href="<?php
echo get_permalink($custom_post->ID);
?>
"> <?php
$excerpt = get_the_title($custom_post->ID);
$excerpt = strip_shortcodes($excerpt);
$word_limit = 5;
echo string_limit_words($excerpt, $word_limit);
?>
…</a></h4>
<?php
}
?>
<?php
/* if ($word_limit > 0) { ?>
<div class="excerpt"><a href="<?php echo get_permalink( $custom_post->ID ); ?>"> <?php $excerpt = get_post_field('post_content', $custom_post->ID); $excerpt = strip_shortcodes( $excerpt ); ;
echo string_limit_words($excerpt,$word_limit);?>…</a></div>
<?php } */
?>
<?php
if ($show_date == 'true') {
?>
<div class="date">
<?php
echo mysql2date('j.m. Y', $custom_post->post_date);
?>
//.........这里部分代码省略.........
开发者ID:Karpec,项目名称:geo-mac,代码行数:101,代码来源:widgets.recent_posts.php
示例11: widget
function widget($args, $instance)
{
extract($args, EXTR_SKIP);
include_once ABSPATH . WPINC . '/rss.php';
// setlocale(LC_TIME, "danish", "da_DK", "da_DK.iso-8859-1", "da_DK.utf-8");
// Widget instance variables
$feed_url = $instance['feed_url'];
$feed = fetch_rss($feed_url);
$title = empty($instance['title']) ? __('RSS news', 'flexible_rss_widget') : apply_filters('widget_title', $instance['title']);
$checkExcerpt = $instance['checkExcerpt'];
$checkAuthor = $instance['checkAuthor'];
$checkDate = $instance['checkDate'];
$checkCats = $instance['checkCats'];
$checkPages = $instance['checkPages'];
$selectCat = (int) $instance['selectCat'];
if (!($number = (int) $instance['number'])) {
$number = 4;
} else {
if ($number < 1) {
$number = 1;
}
}
$items = array_slice($feed->items, 0, $number);
if ($checkCats != 0 && is_category($checkCats) || $checkCats != 0 && is_single() && in_category($checkCats) || $checkPages != 0 && is_page($checkPages) || $checkCats == 0 && $checkPages == 0 && (is_single() || is_singular('anbefalinger') || is_category() || is_tax('materialetyper') || is_page())) {
echo $before_widget;
if (!empty($title)) {
echo $before_title . $title . $after_title;
}
?>
<div class="rss-widget">
<ul>
<?php
if (empty($items)) {
echo '<li>' . _e('There are no posts in this feed') . '</li>';
} else {
foreach ($items as $item) {
?>
<li>
<h3><a class="title" href='<?php
echo $item['link'];
?>
'><?php
if (empty($item['title'])) {
__('Untitled');
} else {
echo $item['title'];
}
?>
</a></h3>
<?php
if ($checkDate == 'date') {
echo '<span class="rss-date">' . strftime('%e. %b %Y', strtotime($item['pubdate'])) . '</span> ';
}
if ($checkAuthor == 'author') {
?>
<span class="meta-prep meta-prep-author"><?php
_e('Af ');
?>
</span><?php
echo '<cite>' . $item['dc']['creator'] . '</cite>';
}
if ($checkExcerpt == 'excerpt') {
echo '<div class="rssSummary">' . string_limit_words($item['description'], 20) . '</div>';
// Set # of words to display in excerpt.
}
?>
</li>
<?php
}
}
?>
<li><a class="widget-rss-link" href="<?php
echo $feed_url;
?>
"><?php
echo __('RSS feed');
?>
</a></li>
</ul>
</div>
<?php
echo $after_widget;
}
// end if
}
开发者ID:horsensbib,项目名称:Flexible-Widgets-for-WordPress,代码行数:85,代码来源:flexible-widgets.php
示例12: get_popular_posts_by_category
<br/>
<br/>
<?php
$pops1 = get_popular_posts_by_category($pages, 13, 4);
foreach ($pops1 as $pop) {
echo $pop->post->post_title;
$post_content = $pop->post->post_content;
}
if (strlen($post_content) <= 140) {
echo $post_content;
} else {
for ($i = 2; strlen(string_limit_words($post_content, $i)) <= 140; $i++) {
}
$i--;
echo string_limit_words($post_content, $i) . "...";
}
?>
<?php
php;
?>
<pre><?php
//var_dump($pops2);
?>
</pre>
<div class="navigation">
<div class="alignleft"><?php
next_posts_link('« Older Entries');
?>
</div>
开发者ID:elizabethcb,项目名称:Daily-Globe,代码行数:30,代码来源:archive.php
示例13: the_permalink
?>
blog-thumbnail-placeholder.jpg"></a>
<?php
}
?>
<div class="blog-content">
<h2><a href="<?php
the_permalink();
?>
"><?php
the_title();
?>
</a></h2>
<p><?php
echo string_limit_words(get_the_content(), 28) . "...";
?>
</p>
<a href="<?php
the_permalink();
?>
">Read More >></a>
</div><!-- END blog-content -->
</div><!-- END blog-post -->
<?php
}
} else {
?>
<p>There are no posts or pages here</p>
开发者ID:admilne,项目名称:wordpress_starter_using_sass,代码行数:31,代码来源:home.php
示例14: setesm_postdisplay_m
//.........这里部分代码省略.........
}
if ($ContactEmail != null) {
echo '<li><strong>Contact Email: </strong>' . $ContactEmail . '</li>';
}
if ($ContactURL != null) {
echo '<li><strong>Contact URL: </strong><a href="' . $ContactURL . '" target="_blank" alt="Grant Link">' . substr($ContactURL, 0, 30) . '</a>...</li>';
}
if ($Eligibility != null) {
echo '<li><strong>Eligibility: </strong>' . $Eligibility . '</li>';
}
if ($GrantDeadline != null) {
$grantdatetime = date_create($GrantDeadline);
echo '<li><strong>Grant Deadline: </strong>' . $grantdatetime->format('l F jS, Y') . '</li>';
}
if ($GrantValue != null) {
echo '<li><strong>Grant Value: </strong>' . $GrantValue . '</li>';
}
echo '</ul></blockquote>';
}
// make sure any advanceded content gets cleared
echo '<div class="clear"></div>';
// Display pagination
echo '<div align="left" style="border-top: 1px solid #ccc; border-bottom: 1px solid #ccc; width:100%; float:left; font-size:20px; font-weight:bold; line-height:30px;">';
if ($ast > 1) {
enhanced_link_pages(array('blink' => '', 'alink' => ' ', 'before' => '<strong>Pages:</strong> ', 'after' => '', 'next_or_number' => 'next', 'afterhref' => 'ast=' . $ast . '&astc=' . $astc));
} else {
enhanced_link_pages(array('blink' => '', 'alink' => ' ', 'before' => '<div class="pagelinks">Pages: ', 'after' => '</div>', 'next_or_number' => 'next'));
}
echo '</div>';
// Post Widget
gab_dynamic_sidebar('PostWidget');
?>
<div style="clear:both;"></div>
<div style="clear:both"></div>
<?php
} else {
?>
<p><?php
print string_limit_words(get_the_excerpt(), 35);
?>
...</p>
<div style="border:#CCCCCC solid 1px; padding:10px;">
<form action="<?php
echo get_option('home');
?>
/wp-login.php" method="post">
<table style="width:100%;">
<tr><td colspan="2"><p><strong>Free registration required to continue reading this article.</strong></p></td></tr>
<tr><td style="width:45%; padding-right:10px; border-right:1px solid #666">
Register today and receive free access to all our news and resources and the ability to customize your news by topic with My eSchool News.<br /><br />
<a href="<?php
echo get_option('home');
?>
/wp-login.php?action=register&redirect_to=?redirect_to=<?php
echo urlencode(get_permalink());
?>
" style="text-decoration:underline;"><strong>Register now.</strong></a>
</td>
<td style="width:55%; padding-left:10px">
Already a member? Log in
<div>Username: <input type="text" name="log" id="log" value="" /></div>
<div>Password:  <input name="pwd" id="pwd" type="password" value="" /></div>
<input type="submit" name="submit" value="Login" class="button">
<input name="rememberme" id="rememberme" type="hidden" checked="checked" value="forever">
<input type="hidden" name="redirect_to" value="<?php
echo $_SERVER['REQUEST_URI'];
?>
">
<br />
<a href="<?php
echo get_option('home');
?>
/wp-login.php?action=lostpassword" target="_blank">Lost Password?</a>
</td></tr></table>
</form>
</div>
<?php
}
//end showpagecontent check
?>
</div>
</div>
<?php
}
开发者ID:esm-erika,项目名称:eschoolnews,代码行数:101,代码来源:esm-function.php
示例15: widget
//.........这里部分代码省略.........
?>
</a></h2>
</div>
</div>
<?php
}
?>
<?php
}
?>
</div>
<div id="tab2" class="tab_content">
<?php
$number = $instance['comments'];
global $wpdb;
$recent_comments = "SELECT DISTINCT ID, post_title, post_password, comment_ID, comment_post_ID, comment_author, comment_author_email, comment_date_gmt, comment_approved, comment_type, comment_author_url, SUBSTRING(comment_content,1,110) AS com_excerpt FROM {$wpdb->comments} LEFT OUTER JOIN {$wpdb->posts} ON ({$wpdb->comments}.comment_post_ID = {$wpdb->posts}.ID) WHERE comment_approved = '1' AND comment_type = '' AND post_password = '' ORDER BY comment_date_gmt DESC LIMIT {$number}";
$the_comments = $wpdb->get_results($recent_comments);
foreach ($the_comments as $comment) {
?>
<div class="block-item-small-tabs">
<div class="block-image"> <?php
echo get_avatar($comment, '50');
?>
</div> <div class="block-image-r">
<h2><?php
echo strip_tags($comment->comment_author);
?>
says:</h2>
<a class="comment-text-side" href="<?php
echo get_permalink($comment->ID);
?>
#comment-<?php
echo $comment->comment_ID;
?>
" title="<?php
echo strip_tags($comment->comment_author);
?>
on <?php
echo $comment->post_title;
?>
"><?php
echo string_limit_words(strip_tags($comment->com_excerpt), 12);
?>
...</a>
</div> </div>
<?php
}
?>
</div>
<div id="tab3" class="tab_content">
<p class='tag_cloud'>
<?php
wp_tag_cloud();
?>
</p>
</div>
</div>
</div>
<!-- END WIDGET -->
<?php
echo $after_widget;
}
开发者ID:m-godefroid76,项目名称:devrestofactory,代码行数:101,代码来源:w.php
示例16: foreach
/*
* Posts inside the current Item
* For each item it generates the posts HTML
*/
$events = $chunk;
foreach ($events as $post) {
setup_postdata($post);
$html .= '<div class="col-xs-12 col-sm-12 col-md-4 col-lg-4 home-page-carousel-item mobile-stacked">';
if (has_post_thumbnail($post->ID)) {
$image = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'single-post-thumbnail');
$html .= '<div class="col-md-12 home-page-carousel-item-inner-top" style="background-image: url(' . $image[0] . '); background-position: 0% 50%;"></div>';
}
$html .= '<div class="col-md-12 home-page-carousel-item-inner-bottom" style="min-height: 110px;">';
$html .= '<strong>' . get_the_title() . '</strong><br>';
$blurb = get_the_excerpt();
$html .= string_limit_words($blurb, 8);
$html .= '</div>';
$html .= '<a href="' . get_permalink() . '"><span class="carousel-item-link"></span></a>';
$html .= '</div>';
}
wp_reset_postdata();
$html .= '</div>';
}
// Prints the HTML
echo $html;
}
?>
</div>
</div> <!-- carousel inner -->
<!-- Controls -->
<a class="left carousel-control" href="#promo-carousel2-m" role="button" data-slide="prev">
开发者ID:AmosFord,项目名称:fordsage,代码行数:31,代码来源:template-fullpage-scroll.php
示例17: while
$slug = $category->slug;
$name = $category->name;
echo "<li class=\"filter btn btn-outline-white btn-small\" data-filter=\"" . $slug . "\">" . $name . "</li>";
}
?>
</ul>
<ul id="portfolio-grid" class="row portfolio-row">
<?php
if (have_posts()) {
while (have_posts()) {
the_post();
?>
<?php
$title = str_ireplace('"', '', trim(get_the_title()));
$desc = string_limit_words(get_the_content(), 25);
$terms = get_the_terms($post->ID, 'portfoliocats');
$permalink = get_permalink($id);
if ($terms && !is_wp_error($terms)) {
$portfolio_links = array();
$parent = array();
foreach ($terms as $term) {
$portfolio_links[] = $term->slug;
$parent[] = $term->parent;
}
$slug = join(" ", $portfolio_links);
$parent_slug = get_term_by('id', $parent[0], 'portfoliocats');
$final_parent = $parent_slug->slug;
$slug .= " " . $final_parent;
}
?>
开发者ID:Brad--,项目名称:exigocorp,代码行数:31,代码来源:section-portfolio.php
示例18: get_category_link
echo '<div class="category_title"><a href="' . get_category_link($category->term_id) . '" title="' . sprintf(__("View all posts in %s"), $category->name) . '" ' . '>' . $category->name . '</a> </div> ';
echo '<ul class="post_list">';
$cat = $category->term_id;
$myPosts = new WP_Query();
$myPosts->query('cat=' . $cat . '&showposts=5');
while ($myPosts->have_posts()) {
$myPosts->the_post();
echo '<li><a href="' . get_permalink() . '">';
if (strlen(get_the_title()) <= 50) {
the_title();
} else {
$i = 11;
$title = string_limit_words(get_the_title(), $i);
while (strlen($title) > 50) {
$i--;
$title = string_limit_words($title, $i);
}
echo $title . "...";
}
echo '</a></li>';
}
echo '</ul>';
echo '</div>';
}
}
?>
</div><!--/justin_page-->
<div class="home-blockofwin-300x250">
</div>
</div><!--/justin_content-->
开发者ID:elizabethcb,项目名称:Daily-Globe,代码行数:31,代码来源:neighborhoods.php
示例19: widget
//.........这里部分代码省略.........
foreach ($recent_comments as $comment) {
$GLOBALS['comment'] = $comment;
switch ($comment->comment_type) {
case '':
$class = "";
if ($i == 0) {
$class .= "first ";
}
if (++$i == count($recent_comments)) {
$class .= "last";
}
?>
<li <?php
if ($class) {
echo "class='{$class}'";
}
?>
>
<div class="avarta"><a href="<?php
comment_link();
?>
"><?php
echo get_avatar($comment, 58, get_bloginfo('template_url') . '/images/mycustomgravatar.png');
?>
</a></div>
<div class="detail">
<div class="comment-author vcard">
<?php
printf(__('%s', 'wpdance'), sprintf('<cite class="fn"><a href="%1$s" rel="external nofollow" class="url">%2$s</a></cite>', get_comment_author_url(), get_comment_author()));
?>
:
</div><!-- .comment-author .vcard -->
<blockquote class="comment-body"><?php
echo string_limit_words(get_comment_text(), 10);
?>
</blockquote>
<div class="comment-meta"><span><?php
_e("in", "wpdance");
?>
<a href="<?php
echo esc_url(get_permalink($comment->comment_post_ID));
?>
"><?php
echo esc_attr(get_the_title($comment->comment_post_ID));
?>
</a></span></div>
</div>
</li>
<?php
break;
case 'pingback':
case 'trackback':
break;
}
?>
<?php
}
?>
</ul>
</div>
<?php
}
?>
<?php
wp_reset_query();
?>
开发者ID:proj-2014,项目名称:vlan247-test-wp2,代码行数:67,代码来源:ew_multitab.php
示例20: populer_posts
function populer_posts()
{
?>
<ul><li id="recent-posts">
<h2>Populer posts</h2>
<ul style="list-style:none;">
<?php
global $post;
$postslist = get_posts('numberposts=3&orderby=comment_count');
foreach ($postslist as $post) {
setup_postdata($post);
?>
<li><a href="<?php
the_permalink();
?>
">
<?php
the_post_thumbnail(array(60, 60), array("class" => "alignleft popular-sidebar"));
?>
</a>
<span style="padding-top:0px;float:left; width:200px;"><a style="float:left; font-weight:bold; width:200px; padding-top:5px;" title="Post: <?php
the_title();
?>
" href="<?php
the_permalink();
?>
"><?php
the_title();
?>
</a><br/>
<?php
$excerpt = get_the_excerpt();
echo string_limit_words($excerpt, 8);
echo " [...]";
//comments_number('0 comments', 'One Comments', '% Comments' );
?>
</span>
<div class="clear"></div>
</li>
<?php
}
?>
</ul>
</li>
<?php
}
开发者ID:bangjojo,项目名称:wp,代码行数:46,代码来源:functions.php
注:本文中的string_limit_words函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论