本文整理汇总了PHP中the_excerpt函数的典型用法代码示例。如果您正苦于以下问题:PHP the_excerpt函数的具体用法?PHP the_excerpt怎么用?PHP the_excerpt使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了the_excerpt函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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();
}
示例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;
}
}
}
示例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
}
}
示例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();
}
示例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;
}
}
}
}
}
示例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
}
示例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
}
示例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;
}
}
示例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;
}
示例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
}
示例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
}
}
}
示例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;
}
}
示例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();
}
示例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>";
}
}
}
示例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;}