本文整理汇总了PHP中get_excerpt函数的典型用法代码示例。如果您正苦于以下问题:PHP get_excerpt函数的具体用法?PHP get_excerpt怎么用?PHP get_excerpt使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_excerpt函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: search_posts
function search_posts($search)
{
global $wpdb, $WPInsights;
$options = $WPInsights->get_options();
$limit = $options['post_results'];
// create query
$search = $wpdb->escape($search);
$posts = $wpdb->get_results("SELECT ID, post_title, post_content, post_type FROM {$wpdb->posts} WHERE post_status = 'publish' AND (post_title LIKE '%{$search}%' OR post_content LIKE '%{$search}%') ORDER BY post_title LIMIT 0," . $limit);
//
if ($posts) {
foreach ($posts as $post) {
// display every post link and excerpt
$output .= '
<p>
<a style="text-decoration:none;" href="' . get_permalink($post->ID) . '" target="_blank">
<strong>' . $post->post_title . '</strong>
</a> <a href="' . $post->post_type . '.php?action=edit&post=' . $post->ID . '" ><img title="Edit ' . $post->post_type . '" src="' . $WPInsights->plugin_url . '/img/edit.png" /></a>
<img title="Insert link to selection" style="cursor:pointer;" onclick="insert_link(\'' . get_permalink($post->ID) . '\');" src="' . $WPInsights->plugin_url . '/img/link.png" />
<p>
' . get_excerpt($post->post_content, 50) . '</p></p>';
}
} else {
$output .= 'Nothing found matching "' . stripslashes($search) . '"';
}
return $output;
}
开发者ID:vpatrinica,项目名称:jfdesign,代码行数:27,代码来源:insights-ajax.php
示例2: excerpt
function excerpt($custom_length = null, $echo = true)
{
$content = apply_filters('the_content', get_excerpt($custom_length));
if ($echo) {
echo $content;
}
return $content;
}
开发者ID:Malagasy,项目名称:arpt-wp-plugs,代码行数:8,代码来源:format.php
示例3: crest_get_page
public function crest_get_page()
{
check_ajax_referer('cr_ajax_obj_wp_nonce');
$paged = $_POST['page'];
// page number
$curr_page = 0;
$output = '';
if (filter_var(intval($paged), FILTER_VALIDATE_INT)) {
$curr_page = $paged;
$args = array('post_type' => 'event', 'paged' => $curr_page, 'orderby' => 'meta_value', 'order' => 'ASC', 'meta_key' => 'date', 'posts_per_page' => 5);
$loop = new WP_Query($args);
if ($loop->have_posts()) {
while ($loop->have_posts()) {
$loop->the_post();
$articleID = get_the_ID();
$articleClass = post_class('cf');
$perma = get_permalink();
$title = get_the_title();
$excerpt = get_excerpt('<span class="read-more">' . __('Read more »', 'bonestheme') . '</span>');
$d = get_field('date');
$d2 = date('F d, Y', strtotime($d));
?>
<article id="post-<?php
the_ID();
?>
" <?php
post_class('cf');
?>
role="article" itemscope itemtype="http://schema.org/BlogPosting">
<header class="article-header">
<h3 class="search-title entry-title">
<a href="<?php
the_permalink();
?>
" rel="bookmark" title="<?php
the_title_attribute();
?>
"><?php
the_title();
?>
</a>
</h3>
<?php
$d = get_field('date');
?>
<?php
$d2 = date('F d, Y', strtotime($d));
?>
<div class="date"><?php
echo $d2;
?>
</div>
</header>
<section class="entry-content cf" itemprop="articleBody">
<?php
the_excerpt('<span class="read-more">' . __('Read more »', 'bonestheme') . '</span>');
?>
</section>
</article>
<?php
}
wp_reset_query();
}
}
exit;
}
开发者ID:jcicero518,项目名称:ExcelsiorWP,代码行数:66,代码来源:class-client-rest-public.php
示例4: the_permalink
</div>
<div class="title">
<h3><a href="<?php
the_permalink();
?>
" rel="bookmark"><?php
the_title();
?>
</a></h3>
</div>
<div class="summary">
<?php
echo catch_that_image();
echo get_excerpt(450);
?>
</div>
<div class="read-more"><a href="<?php
the_permalink();
?>
">Continue reading »</a></div>
<div style="clear:both;"></div>
<div class="posts-list">
<h4>Other recent posts</h4>
<ul>
<?php
while (have_posts()) {
the_post();
?>
开发者ID:nuxeo,项目名称:wp-journalist-nuxeo-theme,代码行数:31,代码来源:home.php
示例5: site_url
<img alt="Feature Image" width="80" class="feature_img_blog" src="<?php
echo site_url('uploads') . "/blog/" . $blog[$i]['featured_image'];
?>
" />
<?php
$width = 'width:581px;';
} else {
$width = 'width:600px;';
}
?>
</div>
<div class="blog_content_inner_right">
<div><?php
echo get_excerpt($blog_description, 250, '...');
?>
</div>
<div ><a style="padding-top:5px;" href="<?php
echo site_url('blog/specific') . "/" . url_title($blog_title, 'dash', true) . "/" . $blog[$i]['blog_id'];
?>
" class="more-link">more</a></div>
</div> <!--</p>-->
</div>
</article>
<hr class="sg_border">
<?php
}
?>
</div>
开发者ID:hardikamutech,项目名称:stacksguide,代码行数:31,代码来源:blog_view.php
示例6: base_url
if ($key == 3) {
break;
}
?>
<div class="recentPots">
<img alt="img" class="thumbRecentPost" src="<?php
echo base_url() . '/uploads/' . $value['image'];
?>
">
<div class="contentRecent">
<h5> <a href="#" class="titleRpost"><?php
echo $value["title"];
?>
</a> </h5>
<p class="contentRpots"><?php
echo get_excerpt($value["description"], 100, '...');
?>
</p>
<div class="clearfix"></div>
</div>
</div>
<?php
}
?>
<!--.recentPots-->
</div>
</div>
<!--.recentPots_cnt-->
开发者ID:hardikamutech,项目名称:campaign,代码行数:31,代码来源:home_view.php
示例7: while
<section id="content" role="main" class="fuller">
<div class="row">
<?php
if (have_posts()) {
while (have_posts()) {
the_post();
echo '<div class="four columns covers fade-in-element">';
the_post_thumbnail('500,500', array('class' => 'u-full-width'));
echo '<div class="post__excerpt">';
echo '<h2 class="releases"><a href="';
the_permalink();
echo '">';
the_title();
echo '</h2></a> ';
echo '<p>';
echo get_excerpt(85);
echo '</p></div>';
echo "</div>";
?>
<?php
}
}
?>
</div>
<div class="row">
<?php
next_posts_link();
?>
开发者ID:jamescambrian,项目名称:cl16,代码行数:31,代码来源:category.php
示例8: the_permalink
<a href="<?php
the_permalink();
?>
" class="post short">
<header class="header">
<h3 class="title"><?php
the_title();
?>
</h3>
<span class="date"><?php
the_time('d/m/Y');
?>
</span>
</header>
<p class="text"><?php
echo get_excerpt($post->ID);
?>
</p>
<div class="link">Read More</div>
</a>
<?php
}
?>
</div> <!-- END content -->
<?php
if ($count > 4) {
?>
<a role="button" class="load_more">Load more posts</a>
<?php
开发者ID:rvdizz,项目名称:wip,代码行数:31,代码来源:index.php
示例9: the_title
?>
" title="Read the full <?php
the_title();
?>
post"><?php
the_title();
?>
</a></h3>
<h4 class="archive-location"><?php
echo esc_html($category[0]->cat_name);
?>
· <?php
echo esc_html($location);
?>
</h4>
<p class="archive-excerpt"><?php
echo get_excerpt();
?>
</p>
</li>
<?php
}
?>
</ul>
</div>
<?php
get_footer();
开发者ID:keoshi,项目名称:19daysinjapan,代码行数:31,代码来源:page-archive.php
示例10: do_action
* @hooked woocommerce_show_product_loop_sale_flash - 10
* @hooked woocommerce_template_loop_product_thumbnail - 10
*/
do_action('woocommerce_before_shop_loop_item_title');
/**
* woocommerce_shop_loop_item_title hook.
*
* @hooked woocommerce_template_loop_product_title - 10
*/
do_action('woocommerce_shop_loop_item_title');
$artist = get_field('artist');
if ($artist) {
setup_postdata($artist);
$picture = get_the_post_thumbnail($artist, 'small-square');
$name = get_the_title($artist);
$bio = get_excerpt($artist);
$url = get_the_permalink($artist);
?>
<h3 class="artist-name"><?php
echo $name;
?>
</h3>
<?php
wp_reset_postdata();
?>
<?php
}
/**
* woocommerce_after_shop_loop_item_title hook.
*
开发者ID:BennyHudson,项目名称:eaton,代码行数:31,代码来源:content-product.php
示例11: category_two_posts_no_thumb_func
function category_two_posts_no_thumb_func($atts, $content)
{
//extract short code attr
extract(shortcode_atts(array('title' => '', 'link' => '', 'category_name' => ''), $atts));
$custom_id = time() . rand();
$output_blog = '';
$output_blog .= "<div class='entry-title'><h3><span>{$title}</span></h3></div>";
global $wp_query;
$temp = $wp_query;
$wp_query = null;
$wp_query = new WP_Query();
$wp_query->query('category_name=' . $category_name . '&showposts=2');
$current = -1;
while ($wp_query->have_posts()) {
$wp_query->the_post();
$current++;
$image_id = get_post_thumbnail_id();
$image_url = wp_get_attachment_image_src($image_id, 'blog_post_image', true);
$imgsource = $image_url[0];
global $post_id;
$postID = get_post($post_id);
global $post;
$temp_link = get_permalink($post->ID);
$temp_title = get_the_title($post->ID);
$temp_date = get_the_time('M j, Y', $post->ID);
$archive_year = get_the_time('Y');
$archive_month = get_the_time('m');
$temp_date_link = get_month_link($archive_year, $archive_month);
$temp_author = get_the_author();
$temp_author_link = get_author_posts_url(get_the_author_meta('ID'));
$temp_excerpt = get_excerpt(220, 'content');
$temp_excerpt_big = get_excerpt(320, 'content');
$categories = get_the_category();
$separator = ', ';
$output = '';
if ($categories) {
foreach ($categories as $category) {
$output .= '<a href="' . get_category_link($category->term_id) . '" title="' . esc_attr(sprintf(__("View all posts in %s", "heman"), $category->name)) . '">' . $category->cat_name . '</a>' . $separator;
}
$categories_item = trim($output, $separator);
}
$output_blog .= "<div class='one_half ";
if ($current % 2 == 0) {
$output_blog .= "first ";
}
$output_blog .= "'>";
$output_blog .= "<div class='post-preview' style='margin-bottom: 0;'>";
$output_blog .= "<div class='full' style='margin-bottom: 0;'>\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t<h4><span style='font-weight: bold; margin-bottom: 10px; float: left; padding-bottom: 10px; border-bottom: dotted 1px #d7d7d7;'><a href='{$temp_link}'>{$temp_title}</a></span></h4>\r\n\t\t\t\t\t\t\t\t\t<div class='post-full'>\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t<p>By <a href='{$temp_author_link}'>{$temp_author}</a> on <a href='{$temp_date_link}'>{$temp_date}</a></p>\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t<p class='post-preview-excerpt'>{$temp_excerpt_big}</p>\r\n\t\t\t\t\t\t\t\t\t\t<span><a href='{$temp_link}'>Read More</a></span>\r\n\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t</div>\r\n\r\n\t\t\t\t\t\t\t\t</div>";
$output_blog .= "</div></div>";
}
global $name;
$category_id = get_cat_ID($name);
$category_link = get_category_link($category_id);
wp_reset_query();
if (!empty($link)) {
$output_blog .= "<div class='full' style='text-align: center;'><a href='{$link}' class='button-ag large read-more' style='margin-right: 0; text-transform:uppercase;'><span class='button-inner'>More Items</span></a></div>";
} else {
$output_blog .= "";
}
return $output_blog;
}
开发者ID:Bitcoinsulting,项目名称:website-ads,代码行数:61,代码来源:shortcode.lib.php
示例12: artist_bio
function artist_bio()
{
if (get_field('artist')) {
$artist = get_field('artist');
if ($artist) {
setup_postdata($artist);
$picture = get_the_post_thumbnail($artist, 'small-square');
$name = get_the_title($artist);
$bio = get_excerpt($artist);
$url = get_the_permalink($artist);
echo '
<div class="artist-widget">
<div class="profile-picture"><a href="' . $url . '">' . $picture . '</a></div>
<h2>' . $name . '</h2>
<p class="bio">' . $bio . '</p>
<p><a href="' . $url . '">See More</a></p>
</div>
';
wp_reset_postdata();
}
}
}
开发者ID:BennyHudson,项目名称:eaton,代码行数:23,代码来源:functions.php
示例13: get_page
</form>
</div>
<div class="clear"> </div>
</div>
</div>
</div>
<!----//End-find-place---->
<!---start-services---->
<div class="wrap">
<?php
if (isset($page)) {
echo get_page($page);
}
?>
<?php
echo get_excerpt($articles, 400);
?>
<div class="clear"></div>
</div>
</div>
</div>
<!---End-services---->
<!---strat-date-piker---->
<script>
$(function() {
$( "#datepicker" ).datepicker();
});
</script>
开发者ID:ankibalyan,项目名称:levoyagers,代码行数:31,代码来源:news_archive.php
示例14: foreach
if ($pagination) {
?>
<section class="pagination"><?php
echo $pagination;
?>
</section>
<?php
}
?>
<div class="row">
<?php
if (count($articles)) {
foreach ($articles as $article) {
?>
<article class="span9"><?php
echo get_excerpt($article);
?>
<hr></article>
<?php
}
}
?>
</div>
</div>
<!-- Sidebar -->
<div class="span3 sidebar">
<h2>Recent news</h2>
<?php
$this->load->view('sidebar');
?>
开发者ID:kew11,项目名称:equanimous-cms,代码行数:31,代码来源:news_archive.php
示例15: the_post_thumbnail
<div class="media-obj__img-div">
<?php
the_post_thumbnail('235x235');
?>
</div>
<div class="media-obj__body">
<h3 class="u-margin-t-flush [ page-title ] media-obj-body__title"><a href="<?php
the_permalink();
?>
"><?php
the_title();
?>
</a></h3>
<p>
<?php
echo get_excerpt(300);
?>
</p>
<a href="<?php
the_permalink();
?>
" class="btn btn--topSection borderDouble button-dark">Read More</a>
</div>
</article>
<?php
}
?>
<?php
} else {
开发者ID:SimoNonnis,项目名称:48newmanStreetTavern,代码行数:31,代码来源:home.php
示例16: foreach
</tr>
</thead>
<tbody>
<?php
foreach ($remove_unsubscribe as $row) {
if ($row['remove_unsubscribe'] == 'text') {
$un = $row['unsubscribe_text'];
} else {
if ($row['remove_unsubscribe'] == 'url') {
$un = $row['unsubscribe_url'];
}
}
$status = $row['status'] == 'Active' ? 'Inactive' : 'Active';
echo '<tr>';
echo '<td>' . $row['remove_unsubscribe_id'] . '</td>';
echo '<td>' . get_excerpt($un, 100, '...') . '</td>';
echo '<td>' . $row['remove_unsubscribe'] . '</td>';
echo '<td>' . $row['status'] . '</td>';
echo '<td style="width:215px;" class="crud-actions">
<a href="' . site_url("kd2a2a0u1g4") . '/remove-unsubscribe/update/' . $row['remove_unsubscribe_id'] . '" class="btn btn-info">view & edit</a>
<a href="' . site_url("kd2a2a0u1g4") . '/remove-unsubscribe/delete/' . $row['remove_unsubscribe_id'] . '" class="btn btn-danger complexConfirm">delete</a>
</td>';
echo '</tr>';
}
?>
</tbody>
</table>
<?php
$this->session->set_userdata('redirect_url', current_url());
echo '<div class="pagination">' . $this->pagination->create_links() . '</div>';
开发者ID:bhushansonar,项目名称:knewdog.com,代码行数:31,代码来源:list.php
示例17: the_post_thumbnail
<?php
if (has_post_thumbnail()) {
the_post_thumbnail('thumbnail');
}
?>
<h4><?php
the_title();
?>
</h4>
<div class="postdate"><?php
echo get_the_date();
?>
</div>
<?php
echo get_excerpt(20);
//the_excerpt();
?>
<div class="q-readmore"><a href="<?php
the_permalink();
?>
">Read more</a></div>
</div><!-- extra cat post -->
<?php
}
?>
<?php
}
// end of latest post
}
开发者ID:accrane,项目名称:Qcity,代码行数:30,代码来源:categoryposts.php
示例18: prefix_load_posts
function prefix_load_posts()
{
$sanitizedRequest = sanitizeRequest($_POST);
$args = array();
/* request key to wp_query key map */
$requestKeyToWpQueryKeyMap = array('onlyWithCategory' => 'cat', 'excludePosts' => 'post__not_in', 'limit' => 'posts_per_page', 'offset' => 'offset');
/* assign wp_query values */
foreach ($sanitizedRequest as $key => $value) {
if (!isset($requestKeyToWpQueryKeyMap[$key])) {
continue;
}
$args[$requestKeyToWpQueryKeyMap[$key]] = $value;
}
/* wp_query default values */
$args['post_status'] = array('publish');
$args['limit'] = isset($args['limit']) ? $args['limit'] : 6;
$args['offset'] = isset($args['offset']) ? $args['offset'] : 0;
$args['orderby'] = isset($args['orderby']) ? $args['orderby'] : 'modified';
$args['order'] = isset($args['order']) ? $args['order'] : 'DESC';
$excerptLength = isset($requestKeyToWpQueryKeyMap['excerptLength']) ? $requestKeyToWpQueryKeyMap['excerptLength'] : 110;
$excerptStyleOption = isset($requestKeyToWpQueryKeyMap['excerptStyleOption']) ? $requestKeyToWpQueryKeyMap['excerptStyleOption'] : 1;
$titleLength = isset($requestKeyToWpQueryKeyMap['titleLength']) ? $requestKeyToWpQueryKeyMap['titleLength'] : 27;
$query = new WP_Query($args);
$posts = $query->get_posts();
$results = array();
foreach ($posts as $post) {
setup_postdata($post);
$post_array = (array) $post;
$post_array['permalink'] = get_permalink($post->ID);
$post_array['thumbnail'] = array();
$image_id = get_post_thumbnail_id($post->ID);
$image_attributes = wp_get_attachment_image_src($image_id, 'small');
$post_array['thumbnail']['small'] = $image_attributes[0];
$post_array['excerpt'] = get_excerpt($excerptLength, $excerptStyleOption, $post);
$post_array['title'] = get_title($titleLength, $post);
$post_array['updated'] = get_the_modified_date('M j, Y');
$results[] = $post_array;
}
echo json_encode($results);
die(1);
}
开发者ID:javed2015,项目名称:WindowsDefender,代码行数:41,代码来源:functions.php
示例19: the_permalink
<article class="water-tile">
<a href="<?php
the_permalink();
?>
" class="water-block" style="background-image: url('<?php
echo $thumb_url;
?>
');">
<h1 class="trip-title"><?php
the_title();
?>
</h1>
</a>
<div class="water-summary">
<p><?php
echo get_excerpt(120);
?>
</p>
<span class="water-detail water-species"><strong>FISH SPECIES:</strong> <?php
echo $water_species;
?>
</span>
<span class="water-detail water-trips"><strong>TRIP TYPES:</strong> <?php
echo $water_trips;
?>
</span>
</div>
</article>
</div>
<?php
开发者ID:johngilesyoder,项目名称:blackfoot,代码行数:31,代码来源:waters.php
示例20: widget
function widget($args, $instance)
{
global $post;
$posts = get_field('posts', 'widget_' . $args['widget_id']);
$size = $instance['size'];
if ($posts) {
echo $args['before_widget'];
if (!empty($instance['title'])) {
echo $args['before_title'] . $instance['title'] . $args['after_title'];
?>
<?php
if (!empty($instance['description'])) {
?>
<div class="widget-description"><?php
echo $instance['description'];
?>
</div>
<?php
}
?>
<?php
}
?>
<ul class="posts size-<?php
echo $size;
?>
">
<?php
foreach ($posts as $post) {
?>
<?php
setup_postdata($post);
?>
<?php
$class = array($instance['size']);
$class[] = has_post_thumbnail() ? 'has-thumbnail' : '';
switch ($size) {
case 'small':
$image_size = array('width' => 100, 'height' => 100);
$title = get_the_title();
break;
case 'medium':
$image_size = array('width' => 65, 'height' => 65);
$title = strlen(get_the_title()) > 25 ? substr(get_the_title(), 0, 25) . ' ...' : get_the_title();
break;
case 'large':
default:
$image_size = array('width' => 200, 'height' => 200);
$title = get_the_title();
break;
}
?>
<li <?php
post_class();
?>
>
<?php
include_module('post-item', array('title' => $title, 'excerpt' => get_excerpt(50), 'url' => get_permalink(), 'image_url' => get_post_thumbnail_src($image_size), 'class' => implode(' ', $class)));
?>
</li>
<?php
}
?>
</ul>
<?php
echo $args['after_widget'];
wp_reset_postdata();
wp_reset_query();
}
}
开发者ID:kishandchips,项目名称:thebankcorporate,代码行数:72,代码来源:posts.php
注:本文中的get_excerpt函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论