本文整理汇总了PHP中truncate_post函数的典型用法代码示例。如果您正苦于以下问题:PHP truncate_post函数的具体用法?PHP truncate_post怎么用?PHP truncate_post使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了truncate_post函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: shortcode_callback
//.........这里部分代码省略.........
}
?>
<div class="et_pb_container clearfix">
<?php
if ('off' !== $show_image && has_post_thumbnail() && !in_array($image_placement, array('background', 'bottom'))) {
?>
<div class="et_pb_slide_image">
<?php
the_post_thumbnail();
?>
</div>
<?php
}
?>
<div class="et_pb_slide_description">
<h2 class="et_pb_slide_title"><a href="<?php
esc_url(the_permalink());
?>
"><?php
the_title();
?>
</a></h2>
<div class="et_pb_slide_content <?php
if ('on' === $hide_content_on_mobile) {
echo esc_attr($hide_on_mobile_class);
}
?>
">
<?php
if ('off' !== $show_meta) {
printf('<p class="post-meta">%1$s | %2$s | %3$s | %4$s</p>', et_get_safe_localization(sprintf(__('by %s', 'et_builder'), '<span class="author vcard">' . et_pb_get_the_author_posts_link() . '</span>')), et_get_safe_localization(sprintf(__('%s', 'et_builder'), '<span class="published">' . esc_html(get_the_date()) . '</span>')), get_the_category_list(', '), sprintf(esc_html(_nx('1 Comment', '%s Comments', get_comments_number(), 'number of comments', 'et_builder')), number_format_i18n(get_comments_number())));
}
?>
<?php
$post_content = get_the_content();
// do not display the content if it contains Blog, Post Slider, Fullwidth Post Slider, or Portfolio modules to avoid infinite loops
if (!has_shortcode($post_content, 'et_pb_blog') && !has_shortcode($post_content, 'et_pb_portfolio') && !has_shortcode($post_content, 'et_pb_post_slider') && !has_shortcode($post_content, 'et_pb_fullwidth_post_slider')) {
if ('on' === $content_source) {
global $more;
$post_content = et_strip_shortcodes($post_content);
// page builder doesn't support more tag, so display the_content() in case of post made with page builder
if (et_pb_is_pagebuilder_used(get_the_ID())) {
$more = 1;
echo apply_filters('the_content', $post_content);
} else {
$more = null;
echo apply_filters('the_content', et_strip_shortcodes(get_the_content(esc_html__('read more...', 'et_builder'))));
}
} else {
if (has_excerpt() && 'off' !== $use_manual_excerpt) {
the_excerpt();
} else {
truncate_post(intval($excerpt_length), true, '', true);
}
}
} else {
if (has_excerpt()) {
the_excerpt();
}
}
?>
</div>
<?php
if ('off' !== $show_more_button && '' !== $more_text) {
printf('<a href="%1$s" class="et_pb_more_button et_pb_button%4$s%5$s"%3$s>%2$s</a>', esc_url(get_permalink()), esc_html($more_text), '' !== $custom_icon && 'on' === $button_custom ? sprintf(' data-icon="%1$s"', esc_attr(et_pb_process_font_icon($custom_icon))) : '', '' !== $custom_icon && 'on' === $button_custom ? ' et_pb_custom_button_icon' : '', 'on' === $hide_cta_on_mobile ? esc_attr(" {$hide_on_mobile_class}") : '');
}
?>
</div> <!-- .et_pb_slide_description -->
<?php
if ('off' !== $show_image && has_post_thumbnail() && 'bottom' === $image_placement) {
?>
<div class="et_pb_slide_image">
<?php
the_post_thumbnail();
?>
</div>
<?php
}
?>
</div> <!-- .et_pb_container -->
</div> <!-- .et_pb_slide -->
<?php
}
// end while
wp_reset_query();
}
// end if
$content = ob_get_contents();
ob_end_clean();
$output = sprintf('<div%3$s class="et_pb_module et_pb_slider et_pb_post_slider%1$s%4$s">
<div class="et_pb_slides">
%2$s
</div> <!-- .et_pb_slides -->
</div> <!-- .et_pb_slider -->
', $class, $content, '' !== $module_id ? sprintf(' id="%1$s"', esc_attr($module_id)) : '', '' !== $module_class ? sprintf(' %1$s', esc_attr($module_class)) : '');
// Restore $wp_filter
$wp_filter = $wp_filter_cache;
unset($wp_filter_cache);
return $output;
}
示例2: the_permalink
?>
</span></span>
<?php
}
?>
</a>
<h3><a href="<?php
the_permalink();
?>
"><?php
the_title();
?>
</a></h3>
<p><?php
truncate_post(115);
?>
</p>
<a href="<?php
the_permalink();
?>
" class="more"><span><?php
esc_html_e('more info', 'eStore');
?>
</span></a>
<?php
if ($et_band != '') {
?>
<span class="band<?php
示例3: the_title
the_title();
?>
"><img src="<?php
bloginfo('stylesheet_directory');
?>
/timthumb.php?src=<?php
echo $thumb;
?>
&h=98&w=98&zc=1" alt="<?php
if ($thumb_alt !== '') {
echo $thumb_alt;
} else {
echo the_title();
}
?>
" style="border: none;" /></a> </div>
<?php
}
?>
<?php
truncate_post(420);
?>
<div style="clear: both;"></div>
</div>
<?php
}
include TEMPLATEPATH . '/includes/page-navigation.php';
} else {
include TEMPLATEPATH . '/includes/no-results.php';
}
wp_reset_query();
示例4: the_title_attribute
" rel="bookmark" title="Permanent Link to <?php
the_title_attribute();
?>
"><?php
the_title();
?>
</a></h2>
<div class="entry">
<?php
if (function_exists('get_the_image')) {
get_the_image(array('custom_key' => array('post_thumbnail'), 'default_size' => 'full', 'image_class' => 'alignleft', 'width' => '198', 'height' => '166'));
}
?>
<p><?php
truncate_post(380, true);
?>
</p>
</div>
<div class="meta">
<span class="time">Posted on <?php
the_time('F d, Y');
?>
</span><a class="more-link" href="<?php
the_permalink();
?>
#more">Read More</a>
</div>
</div>
示例5: et_show_ajax_project
function et_show_ajax_project()
{
global $wp_embed;
$project_id = (int) $_POST['et_project_id'];
$portfolio_args = array('post_type' => 'project', 'p' => $project_id);
$portfolio_query = new WP_Query(apply_filters('et_ajax_portfolio_args', $portfolio_args));
while ($portfolio_query->have_posts()) {
$portfolio_query->the_post();
global $post;
$width = (int) apply_filters('et_ajax_media_width', 600);
$height = (int) apply_filters('et_ajax_media_height', 480);
$titletext = get_the_title();
$media = get_post_meta(get_the_ID(), '_et_used_images', true);
echo '<div class="et_media">';
if ($media) {
echo '<div class="flexslider"><ul class="slides">';
foreach ((array) $media as $et_media) {
echo '<li class="slide">';
if (is_numeric($et_media)) {
$et_fullimage_array = wp_get_attachment_image_src($et_media, 'full');
if ($et_fullimage_array) {
$et_fullimage = $et_fullimage_array[0];
echo '<img src="' . esc_attr(et_new_thumb_resize(et_multisite_thumbnail($et_fullimage), $width, $height, '', true)) . '" width="' . esc_attr($width) . '" height="' . esc_attr($height) . '" alt="' . esc_attr($titletext) . '" />';
}
} else {
$video_embed = apply_filters('the_content', $wp_embed->shortcode('', esc_url($et_media)));
$video_embed = preg_replace('/<embed /', '<embed wmode="transparent" ', $video_embed);
$video_embed = preg_replace('/<\\/object>/', '<param name="wmode" value="transparent" /></object>', $video_embed);
$video_embed = preg_replace("/height=\"[0-9]*\"/", "height={$height}", $video_embed);
$video_embed = preg_replace("/width=\"[0-9]*\"/", "width={$width}", $video_embed);
echo $video_embed;
}
echo '</li>';
}
echo '</ul></div>';
} else {
$thumb = '';
$classtext = '';
$titletext = get_the_title();
$thumbnail = get_thumbnail($width, $height, $classtext, $titletext, $titletext, false, 'Ajaximage');
$thumb = $thumbnail["thumb"];
echo '<a href="' . esc_url(get_permalink()) . '">';
print_thumbnail($thumb, $thumbnail["use_timthumb"], $titletext, $width, $height, $classtext);
echo '</a>';
}
echo '</div> <!-- end .et_media -->';
echo '<div class="et_media_description">' . '<h2 class="title">' . '<a href="' . get_permalink() . '">' . get_the_title() . '</a>' . '</h2>' . truncate_post(560, false);
echo '</div> <!-- end .et_media_description -->';
echo '<a class="more" href="' . get_permalink() . '">' . __('More info »', 'Flexible') . '</a>';
}
wp_reset_postdata();
die;
}
示例6: the_permalink
?>
</a>
<a class="et_portfolio_more_icon" href="<?php
the_permalink();
?>
"><?php
esc_html_e('Read more', 'eStore');
?>
</a>
</div> <!-- end .et_pt_portfolio_image -->
</div> <!-- end .et_pt_portfolio_entry -->
<?php
if ($et_ptemplate_showdesc) {
?>
<p><?php
truncate_post(90);
?>
</p>
<?php
}
?>
</div> <!-- end .et_pt_portfolio_item -->
<?php
if ($et_ptemplate_portfolio_size == 2 && !$fullwidth && $portfolio_count % 2 == 0 || $et_ptemplate_portfolio_size == 3 && $portfolio_count % 2 == 0) {
$et_open_row = false;
?>
</div> <!-- end .et_pt_portfolio_row -->
<?php
}
?>
示例7: the_title
the_title();
?>
</a></h2>
<?php
if ('' != $slide_subtitle) {
?>
<p class="subtitle"><?php
echo esc_html($slide_subtitle);
?>
</p>
<?php
}
?>
<p><?php
truncate_post(180);
?>
</p>
<a href="<?php
echo esc_url($more_link);
?>
" class="more">
<?php
if ('' != $slide_more_text) {
echo esc_html($slide_more_text);
} else {
esc_html_e('Read More', 'Fusion');
}
?>
</a>
示例8: shortcode_callback
//.........这里部分代码省略.........
<a href="<?php
the_permalink();
?>
">
<?php
print_thumbnail($thumb, $thumbnail["use_timthumb"], $titletext, $width, $height);
?>
</a>
<?php
if ('on' !== $fullwidth) {
echo '</div> <!-- .et_pb_image_container -->';
}
}
}
?>
<?php
if ('off' === $fullwidth || !in_array($post_format, array('link', 'audio', 'quote'))) {
?>
<?php
if (!in_array($post_format, array('link', 'audio'))) {
?>
<h2><a href="<?php
the_permalink();
?>
"><?php
the_title();
?>
</a></h2>
<?php
}
?>
<?php
if ('on' === $show_author || 'on' === $show_date || 'on' === $show_categories || 'on' === $show_comments) {
printf('<p class="post-meta">%1$s %2$s %3$s %4$s %5$s %6$s %7$s</p>', 'on' === $show_author ? sprintf(__('by %s', 'et_builder'), et_pb_get_the_author_posts_link()) : '', 'on' === $show_author && 'on' === $show_date ? ' | ' : '', 'on' === $show_date ? sprintf(__('%s', 'et_builder'), get_the_date($meta_date)) : '', ('on' === $show_author || 'on' === $show_date) && 'on' === $show_categories ? ' | ' : '', 'on' === $show_categories ? get_the_category_list(', ') : '', ('on' === $show_author || 'on' === $show_date || 'on' === $show_categories) && 'on' === $show_comments ? ' | ' : '', 'on' === $show_comments ? sprintf(_nx('1 Comment', '%s Comments', get_comments_number(), '', 'et_builder'), number_format_i18n(get_comments_number())) : '');
}
$post_content = get_the_content();
// do not display the content if it contains Blog or Portfolio modules to avoid infinite loops
if (!has_shortcode($post_content, 'et_pb_blog') && !has_shortcode($post_content, 'et_pb_portfolio')) {
if ('on' === $show_content) {
global $more;
// page builder doesn't support more tag, so display the_content() in case of post made with page builder
if (et_pb_is_pagebuilder_used(get_the_ID())) {
$more = 1;
the_content();
} else {
$more = null;
the_content(__('read more...', 'et_builder'));
}
} else {
if (has_excerpt()) {
the_excerpt();
} else {
truncate_post(270);
}
}
} else {
if (has_excerpt()) {
the_excerpt();
}
}
if ('on' !== $show_content) {
$more = 'on' == $show_more ? sprintf(' <a href="%1$s" class="more-link" >%2$s</a>', esc_url(get_permalink()), __('read more', 'et_builder')) : '';
echo $more;
}
?>
<?php
}
// 'off' === $fullwidth || ! in_array( $post_format, array( 'link', 'audio', 'quote', 'gallery'
?>
</article> <!-- .et_pb_post -->
<?php
}
// endwhile
if ('on' === $show_pagination && !is_search()) {
echo '</div> <!-- .et_pb_posts -->';
$container_is_closed = true;
if (function_exists('wp_pagenavi')) {
wp_pagenavi();
} else {
get_template_part('includes/navigation', 'index');
}
}
wp_reset_query();
} else {
get_template_part('includes/no-results', 'index');
}
$posts = ob_get_contents();
ob_end_clean();
$class = " et_pb_module et_pb_bg_layout_{$background_layout}";
$output = sprintf('<div%5$s class="%1$s%3$s%6$s"%7$s>
%2$s
%4$s', 'on' === $fullwidth ? 'et_pb_posts' : 'et_pb_blog_grid clearfix', $posts, esc_attr($class), !$container_is_closed ? '</div> <!-- .et_pb_posts -->' : '', '' !== $module_id ? sprintf(' id="%1$s"', esc_attr($module_id)) : '', '' !== $module_class ? sprintf(' %1$s', esc_attr($module_class)) : '', 'on' !== $fullwidth ? ' data-columns' : '');
if ('on' !== $fullwidth) {
$output = sprintf('<div class="et_pb_blog_grid_wrapper">%1$s</div>', $output);
}
return $output;
}
示例9: et_postinfo_meta
</a></h2>
</div> <!-- .post-description -->
<?php
}
?>
<?php
if ($index_postinfo) {
echo '<p class="meta-info">';
et_postinfo_meta($index_postinfo, et_get_option('foxy_date_format', 'M j, Y'), esc_html__('0 comments', 'Foxy'), esc_html__('1 comment', 'Foxy'), '% ' . esc_html__('comments', 'Foxy'));
echo '</p>';
}
if ('false' == et_get_option('foxy_blog_style', 'false')) {
?>
<p><?php
truncate_post(370);
?>
</p>
<?php
} else {
?>
<?php
the_content('');
}
?>
<a href="<?php
the_permalink();
?>
" class="read-more"><?php
esc_html_e('Read More', 'Foxy');
示例10: the_title
?>
<?php
echo '<i class="fa fa-camera"></i>';
?>
<?php
}
?>
</div>
<div class="content">
<h3 class="itemTitle"><?php
the_title();
?>
</h3>
<?php
truncate_post(220);
?>
<a href="<?php
the_permalink();
?>
"><i class="fa fa-link easeInOut"></i></a>
</div>
</section>
<?php
}
?>
</section>
</section>
<?php
}
示例11: while
$et_videos_output = '';
?>
<?php
if (have_posts()) {
while (have_posts()) {
the_post();
?>
<?php
$width = 48;
$height = 48;
$titletext = get_the_title();
$thumbnail = get_thumbnail($width, $height, 'multi-media-image', $titletext, $titletext, true, 'Media');
$thumb = $thumbnail["thumb"];
$et_medialink = get_post_meta($post->ID, 'et_medialink', true) ? get_post_meta($post->ID, 'et_medialink', true) : '';
$et_videolink = get_post_meta($post->ID, 'et_videolink', true) ? get_post_meta($post->ID, 'et_videolink', true) : '';
$et_media_description = get_post_meta($post->ID, 'et_media_description', true) ? get_post_meta($post->ID, 'et_media_description', true) : truncate_post(90, false);
?>
<?php
if ($media_current_post == 1 || ($media_current_post - 1) % 7 == 0) {
$media_open = true;
?>
<div class="media-slide">
<?php
}
?>
<div class="thumb<?php
if ($media_current_post % 7 == 0) {
echo ' last';
}
?>
">
示例12: get_post_meta
</a></h2>
<?php
$tagline = get_post_meta(get_the_ID(), 'Tagline', true);
if ($tagline != '') {
?>
<p class="tagline">“<?php
echo wp_kses($tagline, array('span' => array()));
?>
”</p>
<?php
}
?>
<p><?php
truncate_post(375);
?>
</p>
<a href="<?php
the_permalink();
?>
" class="readmore"><span><?php
esc_html_e('Read More', 'Minimal');
?>
</span></a>
</div> <!-- end .description -->
</div> <!-- end .slide -->
<?php
}
wp_reset_query();
示例13: the_content
<?php
}
?>
</div> <!-- end .thumbnail -->
<?php
}
?>
<?php
if (get_option('delicatenews_blog_style') == 'on') {
the_content("");
} else {
?>
<p><?php
truncate_post(335);
?>
</p>
<?php
}
?>
<a href="<?php
the_permalink();
?>
" class="readmore"><span><?php
_e('read more', 'DelicateNews');
?>
</span></a>
</div> <!-- end .entry .post -->
示例14: the_permalink
$thumb = $thumbnail["thumb"];
?>
<?php
if ($thumb != '' && get_option('modest_thumbnails_index') == 'on') {
?>
<div class="post-thumbnail">
<a href="<?php
the_permalink();
?>
">
<?php
print_thumbnail($thumb, $thumbnail["use_timthumb"], $titletext, $width, $height, $classtext);
?>
<span class="post-overlay"></span>
</a>
</div> <!-- end .post-thumbnail -->
<?php
}
?>
<?php
if (get_option('modest_blog_style') == 'false') {
?>
<p><?php
truncate_post(680);
?>
</p>
<?php
} else {
?>
示例15: truncate_title
"><?php
if ($biglayout) {
truncate_title(50);
} else {
truncate_title(20);
}
?>
</a></h2>
<div class="entry-content">
<div class="bottom-bg" style="position: relative; top: 30px;">
<div class="excerpt">
<p><?php
if ($biglayout) {
truncate_post(650);
} else {
truncate_post(295);
}
?>
</p>
</div><!-- end .excerpt -->
</div><!-- end .bottom-bg -->
</div><!-- end .entry-content -->
</div><!-- end .entry -->
<?php
} else {
?>
<div class="post">
<div class="post-content clearfix">
<div class="post-text">