本文整理汇总了PHP中has_excerpt函数的典型用法代码示例。如果您正苦于以下问题:PHP has_excerpt函数的具体用法?PHP has_excerpt怎么用?PHP has_excerpt使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了has_excerpt函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: shadesofgray_custom_excerpt_more
/**
* Adds "Continue Reading" link to custom post excerpts.
*/
function shadesofgray_custom_excerpt_more($output)
{
if (has_excerpt() && !is_attachment()) {
$output .= shadesofgray_continue_reading_link();
}
return $output;
}
开发者ID:karan-garg,项目名称:Web-Dev,代码行数:10,代码来源:functions.php
示例2: porto_get_excerpt
function porto_get_excerpt($limit = 45, $more_link = true)
{
global $porto_settings;
if (!$limit) {
$limit = 45;
}
if (has_excerpt()) {
$content = strip_tags(strip_shortcodes(get_the_excerpt()));
} else {
$content = strip_tags(strip_shortcodes(get_the_content()));
}
$content = explode(' ', $content, $limit);
if (count($content) >= $limit) {
array_pop($content);
if ($more_link) {
$content = implode(" ", $content) . '... ';
} else {
$content = implode(" ", $content) . ' [...]';
}
} else {
$content = implode(" ", $content);
}
if ($porto_settings['blog-excerpt-type'] == 'html') {
$content = apply_filters('the_content', $content);
$content = do_shortcode($content);
}
if ($more_link) {
$content .= ' <a class="read-more" href="' . esc_url(apply_filters('the_permalink', get_permalink())) . '">' . __('read more', 'porto') . ' <i class="fa fa-angle-right"></i></a>';
}
if ($porto_settings['blog-excerpt-type'] != 'html') {
$content = '<p class="post-excerpt">' . $content . '</p>';
}
return $content;
}
开发者ID:prosenjit-itobuz,项目名称:Unitee,代码行数:34,代码来源:post.php
示例3: output
function output($options)
{
global $dslc_active;
$post_id = $options['post_id'];
if ($dslc_active && is_user_logged_in() && current_user_can(DS_LIVE_COMPOSER_CAPABILITY)) {
$dslc_is_admin = true;
} else {
$dslc_is_admin = false;
}
if ($dslc_is_admin) {
$the_excerpt = __('Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.', 'live-composer-page-builder');
} else {
$the_excerpt = false;
}
if (is_singular() && get_post_type() !== 'dslc_templates' && has_excerpt()) {
$post_id = get_the_ID();
$post = get_post($post_id);
$the_excerpt = apply_filters('get_the_excerpt', $post->post_excerpt);
}
$this->module_start($options);
/* Module output starts here */
if ($the_excerpt) {
?>
<div class="dslc-tp-excerpt"><?php
echo $the_excerpt;
?>
</div><?php
}
/* Module output ends here */
$this->module_end($options);
}
开发者ID:webeau,项目名称:Live-Composer,代码行数:31,代码来源:module.php
示例4: iced_mocha_custom_excerpt_more
/**
* Adds a pretty "Continue Reading" link to custom post excerpts.
*
* To override this link in a child theme, remove the filter and add your own
* function tied to the get_the_excerpt filter hook.
*
* @since iced_mocha 0.5
* @return string Excerpt with a pretty "Continue Reading" link
*/
function iced_mocha_custom_excerpt_more($output)
{
if (has_excerpt() && !is_attachment() && !get_post_type() == 'espresso_events') {
$output .= iced_mocha_continue_reading_link();
}
return $output;
}
开发者ID:JBNavadiya,项目名称:iced-mocha,代码行数:16,代码来源:theme-loop.php
示例5: italystrap_custom_excerpt_more
function italystrap_custom_excerpt_more($output)
{
if (has_excerpt() && !is_attachment()) {
$output .= italystrap_read_more_link();
}
return $output;
}
开发者ID:AndrGelmini,项目名称:ItalyStrap,代码行数:7,代码来源:custom_excerpt.php
示例6: minileven_custom_excerpt_more
/**
* Adds a pretty "Continue Reading" link to custom post excerpts.
*
* To override this link in a child theme, remove the filter and add your own
* function tied to the get_the_excerpt filter hook.
*/
function minileven_custom_excerpt_more($output)
{
if (has_excerpt() && !is_attachment()) {
$output .= minileven_continue_reading_link();
}
return $output;
}
开发者ID:KurtMakesWeb,项目名称:CandG,代码行数:13,代码来源:tweaks.php
示例7: bootstrapthreeminimal_custom_excerpt_more
/**
* Adds a pretty "Continue Reading" link to custom post excerpts.
*/
function bootstrapthreeminimal_custom_excerpt_more($output)
{
if (has_excerpt() && !is_attachment()) {
$output .= bootstrapthreeminimal_continue_reading_link();
}
return $output;
}
开发者ID:aptiko,项目名称:wordpress-bootstrap3-minimal,代码行数:10,代码来源:functions.php
示例8: airmozilla_custom_excerpt_more
/**
* Adds a pretty "Continue Reading" link to custom post excerpts.
*
* To override this link in a child theme, remove the filter and add your own
* function tied to the get_the_excerpt filter hook.
*/
function airmozilla_custom_excerpt_more($output)
{
if (has_excerpt() && !is_attachment()) {
$output .= airmozilla_continue_reading_link();
}
return $output;
}
开发者ID:guspit,项目名称:One-Mozilla-blog,代码行数:13,代码来源:functions.php
示例9: addWidgetForExcerpt
/**
* Adds toolbox to excerpts wp pages -- can't use addWidget straight out
* because when the filter on get_the_excerpt is added, it doesn't yet know
* if it has an excerpt or not
*
* @param string $content Page contents
* @return string Page content with our sharing button HTML added
*/
public function addWidgetForExcerpt($content)
{
if (has_excerpt() || !is_single()) {
$content = $this->addWidget($content);
}
return $content;
}
开发者ID:OneTimeUser,项目名称:retailwire,代码行数:15,代码来源:addthis-toolbox.php
示例10: swp_get_excerpt_by_id
function swp_get_excerpt_by_id($post_id)
{
// Check if the post has an excerpt
if (has_excerpt()) {
$the_post = get_post($post_id);
//Gets post ID
$the_excerpt = $the_post->post_excerpt;
// If not, let's create an excerpt
} else {
$the_post = get_post($post_id);
//Gets post ID
$the_excerpt = $the_post->post_content;
//Gets post_content to be used as a basis for the excerpt
}
$excerpt_length = 100;
//Sets excerpt length by word count
$the_excerpt = strip_tags(strip_shortcodes($the_excerpt));
//Strips tags and images
$the_excerpt = str_replace(']]>', ']]>', $the_excerpt);
$the_excerpt = strip_tags($the_excerpt);
$excerpt_length = apply_filters('excerpt_length', 100);
$excerpt_more = apply_filters('excerpt_more', ' ' . '[...]');
$words = preg_split("/[\n\r\t ]+/", $the_excerpt, $excerpt_length + 1, PREG_SPLIT_NO_EMPTY);
if (count($words) > $excerpt_length) {
array_pop($words);
// array_push($words, '…');
$the_excerpt = implode(' ', $words);
}
$the_excerpt = preg_replace("/\r|\n/", "", $the_excerpt);
return $the_excerpt;
}
开发者ID:warfare-plugins,项目名称:social-warfare,代码行数:31,代码来源:excerpt.php
示例11: pbosfc_post_excerpt
/**
* Based (with preserved compatibility) on Storefront Blog Excerpts plugin.
*/
function pbosfc_post_excerpt()
{
if (!pbosfc_get_option('post_excerpt')) {
storefront_post_content();
} else {
?>
<div class="entry-content" itemprop="articleBody">
<?php
if (has_post_thumbnail()) {
$thumb_size = pbosfc_get_option('excerpt_image_size');
if ($thumb_size !== 'none') {
$img_class = $thumb_size == 'thumbnail' ? apply_filters('woa_sf_blog_excerpt_image_float', pbosfc_get_option('excerpt_image_float')) : '';
the_post_thumbnail($thumb_size, array('itemprop' => 'image', 'class' => "attachment-{$thumb_size} {$img_class}"));
}
}
$content = do_shortcode(has_excerpt(get_the_ID()) ? get_the_excerpt() : get_the_content());
$content = wp_trim_words($content, pbosfc_get_option('excerpt_word_count'), __('...', 'pbosfc'));
echo apply_filters('the_excerpt', $content);
?>
<p class="read-more"><a class="button"
href="<?php
the_permalink();
?>
"><?php
echo __('Continue reading', 'pbosfc');
?>
</a>
</p>
</div><!-- .entry-content -->
<?php
}
}
开发者ID:boguslawski-piotr,项目名称:pbo-storefront-compact,代码行数:35,代码来源:post.php
示例12: 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
示例13: cosmic_custom_excerpt_more
function cosmic_custom_excerpt_more($output)
{
if (has_excerpt() && !is_attachment()) {
$output .= cosmic_reading_link();
}
return $output;
}
开发者ID:djmacguyver,项目名称:cosmic-wordpress-tools,代码行数:7,代码来源:cosmic-common.php
示例14: momtaz_get_post_class
/**
* Creates a set of classes for each site entry upon display. Each entry is given the class of
* 'hentry'. Posts are given category, tag, and author classes. Alternate post classes of odd,
* even, and alt are added.
*
* @param string|array $class One or more classes to add to the class list.
* @param int $post_id An optional post ID.
* @return array
* @since 1.1
*/
function momtaz_get_post_class($class = '', $post_id = 0)
{
$classes = array();
// Get post object
$post = get_post($post_id);
if (empty($post)) {
return $classes;
}
// hAtom compliance.
$classes[] = 'hentry';
// Get post context.
$context = momtaz_get_post_context($post_id);
// Merge the classes array with post context.
$classes = array_merge($classes, (array) $context);
// Post taxonomies
$post_taxonomies = get_post_taxonomies($post);
if (!empty($post_taxonomies)) {
foreach ($post_taxonomies as $taxonomy) {
$terms = get_the_terms($post->ID, $taxonomy);
if (!empty($terms)) {
foreach ($terms as $term) {
$classes[] = 'term-' . sanitize_html_class($term->slug, $term->term_id);
}
}
}
}
// Sticky posts.
if (is_home() && !is_paged() && is_sticky($post->ID)) {
$classes[] = 'sticky';
}
// Is this post protected by a password?
if (post_password_required($post)) {
$classes[] = 'post-password-required';
}
// Post alt class.
if (!momtaz_is_the_single($post)) {
static $post_alt = 0;
$classes[] = 'set-' . ++$post_alt;
$classes[] = $post_alt % 2 ? 'odd' : 'even';
}
// Has a custom excerpt?
if (has_excerpt($post)) {
$classes[] = 'has-excerpt';
}
// Custom classes.
if (!empty($class)) {
if (!is_array($class)) {
$class = preg_split('#\\s+#', $class);
}
$classes = array_merge($classes, $class);
}
// Apply the WordPress filters.
$classes = apply_filters('post_class', $classes, $class, $post->ID);
// Apply the Momtaz FW filters.
$classes = apply_filters('momtaz_get_post_class', $classes, $post);
// Removes any duplicate and empty classes.
$classes = array_unique(array_filter($classes));
return $classes;
}
开发者ID:emados,项目名称:Momtaz-Framework,代码行数:69,代码来源:entries.php
示例15: widget
/**
* Displays the widget content
*
* @author Konstantin Obeland
* @since 1.1.0 - 08.03.2012
* @access public
*
* @param array $args
* @param array $instance
*
* @return void
*/
public function widget($args, $instance)
{
if (!has_post_format('gallery', $instance['post_id'])) {
return;
}
$attachments = get_children(array('post_parent' => $instance['post_id'], 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID'));
if (empty($attachments)) {
return;
}
extract($args);
echo str_replace('well ', '', $before_widget);
if ($title = get_the_title($instance['post_id'])) {
echo $before_title . '<a href="' . get_permalink($instance['post_id']) . '" title="' . sprintf(esc_attr__('Permalink to %s', 'the-bootstrap'), strip_tags($title)) . '" rel="bookmark">' . $title . '</a>' . $after_title;
}
?>
<div id="sidebar-gallery-slider" class="carousel slide">
<!-- Carousel items -->
<div class="carousel-inner">
<?php
foreach ($attachments as $attachment) {
?>
<figure class="item">
<?php
echo wp_get_attachment_image($attachment->ID, array(370, 278));
if (has_excerpt($attachment->ID)) {
?>
<figcaption class="carousel-caption">
<h4><?php
echo get_the_title($attachment->ID);
?>
</h4>
<p><?php
echo apply_filters('get_the_excerpt', $attachment->post_excerpt);
?>
</p>
</figcaption>
<?php
}
?>
</figure>
<?php
}
?>
</div><!-- .carousel-inner -->
<!-- Carousel nav -->
<a class="carousel-control left" href="#sidebar-gallery-slider" data-slide="prev"><?php
_ex('‹', 'carousel-control', 'the-bootstrap');
?>
</a>
<a class="carousel-control right" href="#sidebar-gallery-slider" data-slide="next"><?php
_ex('›', 'carousel-control', 'the-bootstrap');
?>
</a>
</div><!-- #sidebar-gallery-slider .carousel .slide -->
<?php
echo $after_widget;
}
开发者ID:Covert-Inferno,项目名称:the-bootstrap,代码行数:71,代码来源:the-bootstrap-gallery-widget.php
示例16: get_value
/**
* @see CPAC_Column::get_value()
* @since 2.0
*/
public function get_value($post_id)
{
$value = $this->get_post_excerpt($post_id, $this->options->excerpt_length);
if (!has_excerpt($post_id) && $value) {
$value = '<span class="cpac-inline-info">' . __('Excerpt from content', 'codepress-admin-columns') . '</span> ' . $value;
}
return $value;
}
开发者ID:xeiter,项目名称:timeplannr,代码行数:12,代码来源:excerpt.php
示例17: manual_excerpt_more
function manual_excerpt_more($excerpt)
{
$excerpt_more = '';
if (has_excerpt()) {
$excerpt_more = ' <br/><a href="' . get_permalink() . '" rel="nofollow" class="button">Read more</a>';
}
return $excerpt . $excerpt_more;
}
开发者ID:nickvandijk,项目名称:another-test,代码行数:8,代码来源:functions.php
示例18: wp_slack_testimonials_widget_submit
/**
* Adds new event that send notification to Slack channel
* when someone sent message through Contact Form 7.
*
* @param array $events
* @return array
*
* @filter slack_get_events
*/
function wp_slack_testimonials_widget_submit($events)
{
$events['testimonial_published'] = array('action' => 'publish_testimonials-widget', 'description' => __('When a Testimonials is published', 'slack'), 'default' => false, 'message' => function ($ID, $post) {
$excerpt = has_excerpt($post->ID) ? apply_filters('get_the_excerpt', $post->post_excerpt) : wp_trim_words(strip_shortcodes($post->post_content), 55, '…');
return sprintf('New testimonial published: *<%1$s|%2$s>* by *%3$s*' . "\n" . '> %4$s', get_permalink($post->ID), get_the_title($post->ID), get_the_author_meta('display_name', $post->post_author), $excerpt);
});
return $events;
}
开发者ID:saurabhsirdixit,项目名称:slack-testimonials-widget,代码行数:17,代码来源:slack-testimonials-widget.php
示例19: OW_PageExcerpt
function OW_PageExcerpt($params = array())
{
extract(shortcode_atts(array('slug' => '', 'imagetop' => false, 'imagefirst' => true, 'imagealt' => '', 'container' => '', 'class' => ''), $params));
$ret = '';
if ($slug == '') {
return $ret;
}
// container
if ($class != '' && $container == '') {
$container = 'div';
}
$cstart = '';
$cend = '';
if ($container) {
$cstart = '<' . $container . ($class ? ' class="' . $class . '"' : '') . '>';
$cend = '</' . $container . '>';
}
// find page/post from slug
$q = new WP_Query("pagename={$slug}");
if (!$q->have_posts()) {
$q = new WP_Query("name={$slug}");
}
// the loop
while ($q->have_posts()) {
$q->the_post();
$ispost = has_excerpt();
// link
$link = get_permalink();
// title
$title = the_title('', '', false);
// thumbnail
$img = OW_GetThumbnail();
if (!$img) {
$img = $imagealt;
}
// excerpt
$ex = '';
if (!$ispost) {
$ex = trim(get_post_meta(get_the_ID(), 'description', true));
}
if ($ex == '') {
$ex = get_the_excerpt();
}
$ex = str_replace(array('<br />', ' [...]'), array('', '…'), $ex);
// date
$date = the_date('', '', '', false);
// output
if (function_exists('CustomPageExcerpt')) {
$ret = CustomPageExcerpt($link, $title, $ex, $img, $date);
} else {
if ($img) {
$img = "<a href=\"{$link}\">{$img}</a>";
}
$ret = $cstart . ($imagetop ? $img : '') . '<h2><a href="' . $link . '" title="read the full article">' . $title . "</a></h2>\n" . (!$imagetop && $imagefirst ? $img : '') . ($ispost ? '<p class="info">News article; ' . $date . "</p>\n" : '') . "<p>{$ex} <a href=\"{$link}\" class=\"more\">View »</a></p>\n" . (!$imagetop && !$imagefirst ? $img : '') . $cend;
}
}
return str_replace(BLOGURL, '', $ret);
}
开发者ID:akshaysinghal,项目名称:snippets,代码行数:58,代码来源:shortcodes.php
示例20: peach_excerpt_read_more_link
/**
* If there's a manual excerpt, shove a button link to the
* post afterwards
* @param $output
* @return string
*/
function peach_excerpt_read_more_link($output)
{
global $post;
if (has_excerpt()) {
return $output . bones_excerpt_more('');
} else {
return $output;
}
}
开发者ID:hoonio,项目名称:PhoneAfrika,代码行数:15,代码来源:bones.php
注:本文中的has_excerpt函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论