本文整理汇总了PHP中the_excerpt函数的典型用法代码示例。如果您正苦于以下问题:PHP the_excerpt函数的具体用法?PHP the_excerpt怎么用?PHP the_excerpt使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了the_excerpt函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: homepage_slider
function homepage_slider()
{
query_posts(array('posts_per_page' => -1, 'post__in' => get_option('sticky_posts'), 'meta_key' => '_thumbnail_id'));
?>
<?php
if (have_posts()) {
?>
<style>
.bx-slider{display:none;}
</style>
<ul class="bx-slider">
<?php
while (have_posts()) {
the_post();
echo '<li><a href="' . get_permalink() . '">';
echo '<span class="bx-caption">';
the_title('<h1>', '</h1>');
if (has_excerpt()) {
echo '<p>';
the_excerpt();
echo '</p>';
}
echo '</span>';
the_post_thumbnail('full', 'title="' . get_the_title() . '"');
echo '</a></li>';
}
?>
</ul>
<?php
}
wp_reset_query();
}
开发者ID:pootlepress,项目名称:18tags-slider-add-on,代码行数:32,代码来源:slider-18tags.php
示例2: manage_portfolio_columns
function manage_portfolio_columns($column)
{
global $post;
if ($post->post_type == "portfolio") {
switch ($column) {
case "description":
the_excerpt();
break;
case "portfolio_categories":
$terms = get_the_terms($post->ID, 'portfolio_category');
if (!empty($terms)) {
foreach ($terms as $t) {
$output[] = "<a href='edit.php?post_type=portfolio&portfolio_tag={$t->slug}'> " . esc_html(sanitize_term_field('name', $t->name, $t->term_id, 'portfolio_tag', 'display')) . "</a>";
}
$output = implode(', ', $output);
} else {
$t = get_taxonomy('portfolio_category');
$output = "No {$t->label}";
}
echo $output;
break;
case 'thumbnail':
echo the_post_thumbnail('thumbnail');
break;
}
}
}
开发者ID:kevalbaxi,项目名称:dosomething-blog,代码行数:27,代码来源:portfolio.php
示例3: storefront_post_content
/**
* Display the post content with a link to the single post
* @since 1.0.0
*/
function storefront_post_content()
{
?>
<?php
if (is_search()) {
?>
<div class="entry-summary">
<h2><a href="<?php
the_permalink();
?>
"><?php
the_title();
?>
</a></h2>
<?php
the_excerpt();
?>
</div><!-- .entry-summary -->
<?php
} else {
?>
<div class="entry-content" itemprop="articleBody">
<?php
if (has_post_thumbnail()) {
the_post_thumbnail('full', array('itemprop' => 'image'));
}
the_content(sprintf(__('Continue reading %s', 'storefront'), '<span class="screen-reader-text">' . get_the_title() . '</span>'));
wp_link_pages(array('before' => '<div class="page-links">' . __('Pages:', 'storefront'), 'after' => '</div>'));
?>
</div><!-- .entry-content -->
<?php
}
}
开发者ID:jasonmcclurg,项目名称:lbm,代码行数:37,代码来源:post.php
示例4: widget
function widget($args, $instance)
{
global $post, $wp_query;
Protect();
extract($args, EXTR_SKIP);
$post_query = 'showposts=1&cat=' . $instance['thecat'];
$posts =& query_posts($post_query);
if (have_posts()) {
while (have_posts()) {
the_post();
echo $before_widget;
$title = empty($instance['title']) ? 'Latest Excerpt' : apply_filters('widget_title', $instance['title']);
if (!empty($title)) {
echo $before_title . $title . $after_title;
}
?>
<ul>
<li><a href="<?php
the_permalink();
?>
"><?php
the_title();
?>
</a></li>
<li><?php
the_excerpt();
?>
</li>
</ul>
<?php
echo $after_widget;
}
}
UnProtect();
}
开发者ID:besimhu,项目名称:legacy,代码行数:35,代码来源:latestexcerpt.php
示例5: thinkup_input_blogtext
function thinkup_input_blogtext()
{
global $more;
global $post;
global $thinkup_blog_postswitch;
// Output post thumbnail / featured media
if (is_search()) {
the_excerpt();
} else {
if (!is_search()) {
if ($thinkup_blog_postswitch == 'option1' or empty($thinkup_blog_postswitch)) {
the_excerpt();
} else {
if ($thinkup_blog_postswitch == 'option2') {
// Allow user to user <!--more--> HTML tag
$more = 0;
// Remove all HMTL from the_content - Only allow specified tags
ob_start();
the_content('');
$old_content = ob_get_clean();
$new_content = strip_tags($old_content, '<p><a><b><br/><br /><input><form><textarea><li><ol><ul><table><h1><h2><h3><h4><h5><h6>');
echo $new_content;
}
}
}
}
}
开发者ID:nvvetal,项目名称:water,代码行数:27,代码来源:05.blog.php
示例6: widget
/** @see WP_Widget::widget */
function widget($args, $instance)
{
extract($args);
global $wp_query;
$get_quotes = new WP_Query("post_type=quotes&post_status=publish&posts_per_page=1&orderby=rand");
?>
<li class="featured-quote">
<?php
while ($get_quotes->have_posts()) {
$get_quotes->the_post();
global $post;
$link = get_post_meta($post->ID, "info_box_link", true);
?>
<blockquote>
<?php
the_excerpt();
?>
</blockquote>
<cite>~ <a href="<?php
echo $link;
?>
"><?php
the_title();
?>
</a></cite>
<?php
}
?>
</li>
<?php
}
开发者ID:shimion,项目名称:git,代码行数:36,代码来源:quotes-widget.php
示例7: bizz_post_content_query
/**
* POST CONTENT - query posts
*
* output post content for Query Posts widget, based on predefined arguments
* @since 7.0
*/
function bizz_post_content_query($args = '', $post_count = false)
{
global $wp_query, $post, $opt;
bizz_hook_before_post($post_count);
#hook
echo "<" . apply_filters('bizz_html5_section', "div") . " class=\"format_text\">\n";
$selflink = isset($args['thumb_selflink']) && $args['thumb_selflink'] == true ? true : false;
$cropp = isset($args['thumb_cropp']) && $args['thumb_cropp'] != '' ? $args['thumb_cropp'] : 'c';
if (isset($opt['bizzthemes_thumb_show']['value']) && $args['thumb_display']) {
bizz_image('width=' . $args['thumb_width'] . '&height=' . $args['thumb_height'] . '&class=thumbnail ' . $args['thumb_align'] . '&cropp=' . $cropp . '&selflink=' . $selflink . '&filter=' . $args['thumb_filter'] . '&sharpen=' . $args['thumb_sharpen'] . '');
}
if ($args['remove_posts'] == '0') {
if ($args['full_posts'] == '0' && (is_archive() || $wp_query->is_posts_page || is_search() || is_home())) {
the_excerpt();
if ($args['read_more']) {
echo apply_filters('bizz_read_more', '<span class="read-more"><a href="' . get_permalink() . '" class="url fn" rel="nofollow">' . $args['read_more_text'] . '</a></span>');
}
} else {
the_content($args['read_more_text']);
}
wp_link_pages(array('before' => '<div class="page-link">', 'after' => '</div>'));
}
echo '<div class="fix"><!----></div>';
echo "</" . apply_filters('bizz_html5_section', "div") . ">\n";
bizz_hook_after_post($post_count);
#hook
}
开发者ID:loevendahl,项目名称:flexbil,代码行数:33,代码来源:frame_html_content.php
示例8: custom_columns
/**
* Customize the columns in the table of all post types
*
* @since 1.0.0
*/
public function custom_columns($column)
{
global $post;
switch ($column) {
case "image":
if (has_post_thumbnail()) {
echo get_the_post_thumbnail(null, 'thumb-testimonial');
}
break;
case 'story':
the_excerpt();
break;
case 'website':
$label = yit_get_post_meta(get_the_ID(), '_site-label');
$siteurl = yit_get_post_meta(get_the_ID(), '_site-url');
if ($siteurl != '') {
if ($label != '') {
echo '<a href="' . esc_url($siteurl) . '">' . $label . '</a>';
} else {
echo '<a href="' . esc_url($siteurl) . '">' . $siteurl . '</a>';
}
}
break;
}
}
开发者ID:gloomyghost,项目名称:Tip-Top-Art,代码行数:30,代码来源:Testimonial.php
示例9: widget
/** @see WP_Widget::widget */
function widget($args, $instance)
{
extract($args);
$title = apply_filters('widget_title', $instance['title']);
$post_type = $instance['post_type'];
$link_text = $instance['link_text'];
echo $before_widget;
if ($title) {
echo $before_title . $title . $after_title;
}
query_posts(array('post_type' => $post_type, 'showposts' => 1));
if (have_posts()) {
while (have_posts()) {
the_post();
$content = substr(get_the_content(), 0, 100);
the_title('<h4>', '</h4>');
the_excerpt();
?>
<a href="<?php
the_permalink();
?>
" class="btn_Select" title="<?php
the_title_attribute();
?>
"><span><?php
echo $link_text;
?>
</span><strong>></strong></a><?php
}
} else {
_e('Sorry, no posts matched your criteria.');
}
wp_reset_query();
echo $after_widget;
}
开发者ID:besimhu,项目名称:legacy,代码行数:36,代码来源:widget.php
示例10: post_excerpts_here
function post_excerpts_here()
{
//posts with date, author, time, content excerpts, and title..
if (have_posts()) {
while (have_posts()) {
echo '<div class="excerpt-div">';
the_post();
echo '<h2 class="post-title"><a href="';
the_permalink();
echo '" title="';
the_title();
echo '">';
the_title();
echo '</a></h2>';
echo '<h4 class="post-info">';
echo 'Created on ';
the_date();
echo ' at ';
the_time();
echo ' by ';
the_author_meta(first_name);
echo '.</h4>';
echo '<p class="post-excerpt">';
the_excerpt();
echo '</p>';
echo '</div>';
}
// end while
}
// end if
}
开发者ID:jbrown25,项目名称:Apicat-WP-theme,代码行数:31,代码来源:functions.php
示例11: my_facebook_tags
function my_facebook_tags()
{
if (is_single()) {
?>
<meta property="og:title" content="<?php
the_title();
?>
" />
<meta property="og:site_name" content="<?php
bloginfo('name');
?>
" />
<meta property="og:url" content="<?php
the_permalink();
?>
" />
<meta property="og:description" content="<?php
the_excerpt();
?>
" />
<meta property="og:type" content="article" />
<?php
if (has_post_thumbnail()) {
$image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'large');
?>
<meta property="og:image" content="<?php
echo $image[0];
?>
" />
<?php
}
}
}
开发者ID:hollandlive,项目名称:ivik,代码行数:33,代码来源:wp_plugin_my_facebook_tags.php
示例12: organizedthemes_manage_testimony_columns
function organizedthemes_manage_testimony_columns($column, $post_id)
{
global $post;
switch ($column) {
/* If displaying the 'job title' column. */
case 'testimony_title':
/* Get the post meta. */
$job_title = get_post_meta($post_id, 'title', true);
/* If no duration is found, output a default message. */
if (empty($job_title)) {
echo __('', 'organizedthemes');
} else {
printf(__('%s'), $job_title);
}
break;
/* If displaying the 'testimony-group' column. */
/* If displaying the 'testimony-group' column. */
case "testimony_content":
//Adds the excerpt to the bio column
the_excerpt();
break;
/* Just break out of the switch statement for everything else. */
/* Just break out of the switch statement for everything else. */
default:
break;
}
}
开发者ID:Ezyva2015,项目名称:money101.com.au,代码行数:27,代码来源:testimony.php
示例13: load_posts
function load_posts()
{
// variaveis da query
$numPosts = isset($_GET['numPosts']) ? $_GET['numPosts'] : 0;
$page = isset($_GET['page']) ? $_GET['page'] : 0;
// modificados do loop
query_posts(array('post_por_page' => $numPosts, 'paged' => $page, 'post_status' => 'publish', 'post_type' => 'post'));
// loop
if (have_posts()) {
while (have_posts()) {
the_post();
?>
<article class="artigos">
<h1><?php
the_title();
?>
</h1>
<?php
the_excerpt();
?>
</article>
<?php
}
}
// limpa da memória a query
wp_reset_query();
// finaliza o script
wp_die();
}
开发者ID:carlosCsc,项目名称:tutorial_wordpress_ajax,代码行数:29,代码来源:functions.php
示例14: kool_preview_boxes
/**
* kool_preview_boxes shows the next set of posts. It shows as many boxes as
* you show posts on your blog page. This works best when there is an even
* number of posts displayed (2,4,6,8,10) but it can work with an odd number
* if alignment is set or if the width of boxes is set to 100% which would allow
* for a column effct.
*
* To use kool_preview simply add the function call in your theme's index after
* the content is displayed. I could technically go before as well.
*/
function kool_preview_boxes()
{
global $post;
if (is_paged()) {
$target_page = get_query_var('paged') + 1;
} else {
$target_page = 2;
}
$args = array('paged' => $target_page, 'orderby' => 'post_date', 'post_type' => 'post', 'post_status' => 'publish');
$k_posts = new WP_Query($args);
if ($k_posts and $k_posts->have_posts()) {
while ($k_posts->have_posts()) {
$k_posts->the_post();
$thumb_query = array('numberposts' => 1, 'post_type' => 'attachment', 'post_parent' => $post->ID);
echo '<div class="preview_box" >';
$attachment = get_posts($thumb_query);
foreach ($attachment as $attach) {
if ($attach) {
$img = wp_get_attachment_image_src($attach->ID, $size = 'thumbnail', $icon = true);
echo "<img class='preview_thumb' src='{$img['0']}' >";
}
}
echo '<a rel="bookmark" href=';
the_permalink();
echo '>';
echo the_title() . '</a><br>';
the_excerpt();
echo "</div>";
}
}
}
开发者ID:Nectarineimp,项目名称:Koolkit,代码行数:41,代码来源:koolFunctions.php
示例15: categori_news
function categori_news(){
query_posts('cat=9&showposts=10&posts_per_page=3');
while (have_posts()) : the_post();
/*Dima insert*/the_excerpt(); ?>
<div class="content-box">
<div class="bgr01"><div class="bgr02"><div class="bgr03">
<div <?php post_class() ?> id="post-<?php the_ID(); ?>" style=" float:none; ">
<div class="title">
<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
<div class="date_all">
<?php the_time('l, j ?F, Y') ?>
</div>
<div class="post">
Написал <?php the_author_link() ?> <?php the_time('g:i A') ?>
</div>
</div>
<div class="content_box">
<?php the_content('Читать всё'); ?>
</div>
<div class="postmetadata"><?php the_tags('Tags: ', ', ', '<br />'); ?></div>
<div class="comments"><?php comments_popup_link('0 комментарии', 'комментарии', '% комментарии '); ?></div>
<div class="link-edit"><?php edit_post_link('Edit', ''); ?></div>
</div>
</div></div></div>
</div>
<?php endwhile;}
开发者ID:xronn01,项目名称:www.prosvitcenter.org,代码行数:29,代码来源:myfunk.php
示例16: widget
/**
** Front-end display of widget.
**
** @see WP_Widget::widget()
**
** @param array $args Widget arguments.
** @param array $instance Saved values from database.
**/
function widget($args, $instance)
{
extract($args);
$thisTitle = $instance['title'];
$thisNumber = $instance['num'];
$thisCategory = $instance['cat'];
$category_link = get_category_link($thisCategory);
$titleBarSpan = '<span class="block section-title-bar">' . $thisTitle . '</span>';
$titleBarLink = '<a href="' . esc_url($category_link) . '">' . $titleBarSpan . '</a>';
$argsQueryPosts = array('cat' => $thisCategory, 'showposts' => $thisNumber);
$thisQuery = new WP_Query($argsQueryPosts);
echo "\n";
echo ' <div class="container newlife-widget newlife-snippet-posts">' . "\n";
if ($thisCategory != 0) {
echo ' ' . $titleBarLink . "\n";
} else {
echo ' ' . $titleBarSpan . "\n";
}
echo ' <div class="snippet-posts">' . "\n";
while ($thisQuery->have_posts()) {
$thisQuery->the_post();
ob_start();
?>
<div class="post">
<div class="post-title">
<h2><a href="<?php
echo get_permalink();
?>
" rel="bookmark"><?php
echo the_title();
?>
</a></h2>
</div>
<div class="post-entry">
<?php
the_excerpt();
echo "\n";
?>
</div>
<div class="post-meta">
<?php
newlife_post_data();
echo "\n";
?>
</div>
<div class="clear"></div>
</div>
<?php
echo ob_get_clean();
}
echo ' <div class="navigation-posts">' . "\n";
echo ' </div>' . "\n";
echo ' <div class="clear"></div>' . "\n";
echo ' </div>' . "\n";
echo " </div>\n";
wp_reset_postdata();
}
开发者ID:jnsnkrllive,项目名称:wordpress-theme-newlifea2,代码行数:67,代码来源:newlife-widget-snippet-posts.php
示例17: widget
/** @see WP_Widget::widget */
function widget($args, $instance)
{
extract($args);
$post_type = $instance['post_type'];
$num_items = $instance['num_items'];
query_posts(array('post_type' => $post_type, 'showposts' => $num_items));
if (have_posts()) {
?>
<div id="myCarousel" class="carousel slide">
<div class="carousel-inner">
<?php
global $post;
$count = 0;
while (have_posts()) {
the_post();
//var_dump($post);
?>
<div class="item <?php
echo $count == 0 ? 'active' : '';
?>
">
<?php
if (has_post_thumbnail()) {
the_post_thumbnail('portfolio-slider-image');
}
?>
<div class="container">
<div class="carousel-caption">
<?php
the_title('<h1>', '</h1>');
?>
<p class="lead"><?php
the_excerpt();
?>
</p>
<a class="btn btn-large btn-primary" href="<?php
the_permalink();
?>
">View project</a>
</div>
</div>
</div>
<?php
$count++;
}
?>
</div>
<a class="left carousel-control" href="#myCarousel" data-slide="prev">‹</a>
<a class="right carousel-control" href="#myCarousel" data-slide="next">›</a>
</div><!-- /.carousel -->
<?php
} else {
_e('Sorry, no posts matched your criteria.');
}
wp_reset_query();
}
开发者ID:besimhu,项目名称:legacy,代码行数:60,代码来源:widget.php
示例18: tree_species_post_excerpt
function tree_species_post_excerpt()
{
if (get_post_type() == 'post') {
the_excerpt();
} else {
the_tree_species_exceprt();
}
}
开发者ID:shaulfiron,项目名称:tree-species,代码行数:8,代码来源:post-methods.php
示例19: the_pickup_excerpt
function the_pickup_excerpt()
{
add_filter('get_the_excerpt', 'get_pickup_excerpt', 0);
add_filter('excerpt_mblength', 'pickup_excerpt_length', 11);
the_excerpt();
remove_filter('get_the_excerpt', 'get_pickup_excerpt', 0);
remove_filter('excerpt_mblength', 'pickup_excerpt_length', 11);
}
开发者ID:bulluck,项目名称:ATOGAMA,代码行数:8,代码来源:functions.php
示例20: powen_content
function powen_content()
{
if (powen_mod('content_length') == 'full') {
the_content();
} else {
the_excerpt();
}
}
开发者ID:brandonlucasgreen,项目名称:tdcb,代码行数:8,代码来源:custom-functions.php
注:本文中的the_excerpt函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论