本文整理汇总了PHP中tf_content函数的典型用法代码示例。如果您正苦于以下问题:PHP tf_content函数的具体用法?PHP tf_content怎么用?PHP tf_content使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了tf_content函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_post_meta
?>
<div class="content-sep"></div>
<?php
}
?>
<div class="post-content">
<?php
if (get_post_meta($current_page_id, 'pyre_portfolio_excerpt', true)) {
$excerpt_length = get_post_meta($current_page_id, 'pyre_portfolio_excerpt', true);
} else {
$excerpt_length = $smof_data['excerpt_length_portfolio'];
}
?>
<?php
if ($smof_data['portfolio_content_length'] == 'Excerpt' && get_post_meta($current_page_id, 'pyre_portfolio_content_length', true) != 'full_content' || get_post_meta($current_page_id, 'pyre_portfolio_content_length', true) == 'excerpt') {
$stripped_content = strip_shortcodes(tf_content($excerpt_length, $smof_data['strip_html_excerpt']));
echo $stripped_content;
} else {
the_content();
}
?>
</div>
</div>
</div>
</div>
<?php
}
}
?>
</div>
<?php
示例2: the_permalink
?>
<div class="portfolio-content clearfix">
<h2 class="entry-title"><a href="<?php
the_permalink();
?>
"><?php
the_title();
?>
</a></h2>
<h4><?php
echo get_the_term_list($post->ID, 'portfolio_category', '', ', ', '');
?>
</h4>
<?php
if ($data['portfolio_content_length'] == 'Excerpt') {
$stripped_content = strip_shortcodes(tf_content($data['excerpt_length_portfolio'], $data['strip_html_excerpt']));
echo $stripped_content;
} else {
the_content();
}
?>
</div>
<?php
}
?>
<?php
if ($data['portfolio_archive_layout'] == 'Portfolio One Column Text' || $data['portfolio_archive_layout'] == 'Portfolio One Column') {
?>
<div class="buttons">
<a href="<?php
the_permalink();
示例3: render
//.........这里部分代码省略.........
$format_class = 'quotes-left';
break;
case 'video':
$format_class = 'film';
break;
case 'audio':
$format_class = 'headphones';
break;
case 'chat':
$format_class = 'bubbles';
break;
default:
$format_class = 'pen';
break;
}
$date_box = sprintf('<div %s><div %s><span %s>%s</span><span %s>%s</span></div><div %s><i %s></i></div></div>', FusionCore_Plugin::attributes('date-and-formats'), FusionCore_Plugin::attributes('date-box'), FusionCore_Plugin::attributes('date'), get_the_time('j'), FusionCore_Plugin::attributes('month-year'), get_the_time('m, Y'), FusionCore_Plugin::attributes('format-box'), FusionCore_Plugin::attributes('icon-' . $format_class));
}
if ($thumbnail == 'yes' && $layout != 'date-on-side') {
if ($layout == 'default') {
$image_size = 'recent-posts';
} elseif ($layout == 'thumbnails-on-side') {
$image_size = 'portfolio-two';
}
if ($smof_data['legacy_posts_slideshow']) {
$args = array('exclude' => get_post_thumbnail_id(), 'numberposts' => $smof_data['posts_slideshow_number'] - 1, 'order' => 'ASC', 'orderby' => 'menu_order', 'post_mime_type' => 'image', 'post_parent' => get_the_ID(), 'post_status' => null, 'post_type' => 'attachment');
$attachments = get_posts($args);
if ($attachments || has_post_thumbnail() || get_post_meta(get_the_ID(), 'pyre_video', true)) {
if (get_post_meta(get_the_ID(), 'pyre_video', true)) {
$slides .= sprintf('<li><div %s>%s</div></li>', FusionCore_Plugin::attributes('full-video'), get_post_meta(get_the_ID(), 'pyre_video', true));
}
if (has_post_thumbnail()) {
$attachment_image = wp_get_attachment_image_src(get_post_thumbnail_id(), $image_size);
$full_image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full');
$attachment_data = wp_get_attachment_metadata(get_post_thumbnail_id());
$slides .= sprintf('<li><a href="%s"><img %s/></a></li>', get_permalink(get_the_ID()), FusionCore_Plugin::attributes('recentposts-shortcode-img', array('src' => $attachment_image[0], 'alt' => get_the_title())));
}
if ($smof_data['posts_slideshow']) {
foreach ($attachments as $attachment) {
$attachment_image = wp_get_attachment_image_src($attachment->ID, $image_size);
$full_image = wp_get_attachment_image_src($attachment->ID, 'full');
$attachment_data = wp_get_attachment_metadata($attachment->ID);
$slides .= sprintf('<li><a href="%s"><img %s/></a></li>', get_permalink(get_the_ID()), FusionCore_Plugin::attributes('recentposts-shortcode-img', array('src' => $attachment_image[0], 'alt' => $attachment->post_title)));
}
}
$slideshow = sprintf('<div %s><ul %s>%s</ul></div>', FusionCore_Plugin::attributes('recentposts-shortcode-slideshow'), FusionCore_Plugin::attributes('slides'), $slides);
}
} else {
if (has_post_thumbnail() || get_post_meta(get_the_ID(), 'pyre_video', true)) {
if (get_post_meta(get_the_ID(), 'pyre_video', true)) {
$slides .= sprintf('<li><div %s>%s</div></li>', FusionCore_Plugin::attributes('full-video'), get_post_meta(get_the_ID(), 'pyre_video', true));
}
if (has_post_thumbnail()) {
$attachment_image = wp_get_attachment_image_src(get_post_thumbnail_id(), $image_size);
$full_image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full');
$attachment_data = wp_get_attachment_metadata(get_post_thumbnail_id());
$attachment = get_post(get_post_thumbnail_id());
$slides .= sprintf('<li><a href="%s"><img %s/></a></li>', get_permalink(get_the_ID()), FusionCore_Plugin::attributes('recentposts-shortcode-img', array('src' => $attachment_image[0], 'alt' => $attachment->post_title)));
}
if ($smof_data['posts_slideshow']) {
$i = 2;
while ($i <= $smof_data['posts_slideshow_number']) {
$attachment_new_id = kd_mfi_get_featured_image_id('featured-image-' . $i, 'post');
if ($attachment_new_id) {
$attachment_image = wp_get_attachment_image_src($attachment_new_id, $image_size);
$full_image = wp_get_attachment_image_src($attachment_new_id, 'full');
$attachment_data = wp_get_attachment_metadata($attachment_new_id);
$slides .= sprintf('<li><a href="%s"><img %s/></a></li>', get_permalink(get_the_ID()), FusionCore_Plugin::attributes('recentposts-shortcode-img', array('src' => $attachment_image[0], 'alt' => '')));
}
$i++;
}
}
$slideshow = sprintf('<div %s><ul %s>%s</ul></div>', FusionCore_Plugin::attributes('recentposts-shortcode-slideshow'), FusionCore_Plugin::attributes('slides'), $slides);
}
}
}
if ($title == 'yes') {
$content .= sprintf('<h4><a href="%s">%s</a></h4>', get_permalink(get_the_ID()), get_the_title());
}
if ($meta == 'yes') {
$comments = '';
if (get_comments_number(get_the_ID()) >= 1) {
$comments = sprintf('<span %s>|</span><a href="%s">%s %s</a></span>', FusionCore_Plugin::attributes('meta-separator'), get_permalink(get_the_ID()), get_comments_number(get_the_ID()), __('Comments', 'Avada'));
}
$content .= sprintf('<p %s><span><time %s>%s</time></span>%s</p>', FusionCore_Plugin::attributes('meta'), FusionCore_Plugin::attributes('date'), get_the_time($smof_data['date_format'], get_the_ID()), $comments);
}
if ($excerpt == 'yes') {
$content .= tf_content($excerpt_words, $strip_html);
}
if ($count == self::$args['columns']) {
$count = 0;
$items .= sprintf('<article %s>%s%s<div %s>%s</div></article><div class="fusion-clearfix"></div>', FusionCore_Plugin::attributes('recentposts-shortcode-column'), $date_box, $slideshow, FusionCore_Plugin::attributes('recent-posts-content'), $content);
} else {
$items .= sprintf('<article %s>%s%s<div %s>%s</div></article>', FusionCore_Plugin::attributes('recentposts-shortcode-column'), $date_box, $slideshow, FusionCore_Plugin::attributes('recent-posts-content'), $content);
}
$count++;
}
$html = sprintf('<div %s><section %s><div %s>%s</div></section></div>', FusionCore_Plugin::attributes('recentposts-shortcode'), FusionCore_Plugin::attributes('recentposts-shortcode-section'), FusionCore_Plugin::attributes('row holder'), $items);
wp_reset_query();
return $html;
}
示例4: if
<?php endif; ?>
<div class="post-content">
<?php if($data['blog_layout'] == 'Large Alternate' || $data['blog_layout'] == 'Medium Alternate' || $data['blog_layout'] == 'Grid' || $data['blog_layout'] == 'Timeline'): ?>
<h2 class="post-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
<?php if($data['post_meta']): ?>
<?php if($data['blog_layout'] == 'Grid' || $data['blog_layout'] == 'Timeline'): ?>
<p class="single-line-meta"><?php if(!$data['post_meta_author']): ?><?php echo __('By', 'Avada'); ?> <?php the_author_posts_link(); ?><span class="sep">|</span><?php endif; ?><?php if(!$data['post_meta_date']): ?><?php the_time($data['date_format']); ?><?php endif; ?></p>
<?php else: ?>
<p class="single-line-meta"><?php if(!$data['post_meta_author']): ?><?php echo __('By', 'Avada'); ?> <?php the_author_posts_link(); ?><span class="sep">|</span><?php endif; ?><?php if(!$data['post_meta_date']): ?><?php the_time($data['date_format']); ?><span class="sep">|</span><?php endif; ?><?php if(!$data['post_meta_cats']): ?><?php the_category(', '); ?><span class="sep">|</span><?php endif; ?><?php if(!$data['post_meta_comments']): ?><?php comments_popup_link(__('0 Comments', 'Avada'), __('1 Comment', 'Avada'), '% '.__('Comments', 'Avada')); ?><?php endif; ?></p>
<?php endif; ?>
<?php endif; ?>
<?php endif; ?>
<div class="content-sep"></div>
<?php
if($data['content_length'] == 'Excerpt') {
$stripped_content = tf_content( $data['excerpt_length_blog'], $data['strip_html_excerpt'] );
echo $stripped_content;
} else {
the_content('');
}
?>
</div>
<div style="clear:both;"></div>
<?php if($data['post_meta']): ?>
<div class="meta-info">
<?php if($data['blog_layout'] == 'Grid' || $data['blog_layout'] == 'Timeline'): ?>
<?php if($data['blog_layout'] != 'Large Alternate' && $data['blog_layout'] != 'Medium Alternate'): ?>
<div class="alignleft">
<?php if(!$data['post_meta_read']): ?><a href="<?php the_permalink(); ?>" class="read-more"><?php echo __('Read More', 'Avada'); ?></a><?php endif; ?>
</div>
<?php endif; ?>
示例5: blog_shortcode
//.........这里部分代码省略.........
$html.= '<p class="single-line-meta vcard">';
if($atts['meta_author']) {
$html .= __('By', 'Avada') .' ';
ob_start();
the_author_posts_link();
$html .= '<span class="fn">'.ob_get_clean().'</span><span class="sep">|</span>';
}
if($atts['meta_date']) {
$html .= '<span class="updated">'.get_the_time($data["date_format"]).'</span><span class="sep">|</span>';
}
if($atts['meta_categories']) {
ob_start();
the_category(', ');
$html .= ob_get_clean().'<span class="sep">|</span>';
}
if($atts['meta_comments']) {
ob_start();
comments_popup_link(__('0 Comments', 'Avada'), __('1 Comment', 'Avada'), '% '.__('Comments', 'Avada'));
$html .= ob_get_clean().'<span class="sep">|</span>';
}
$html .= '</p>';
}
}
}
$html .= '<div class="content-sep"></div>';
// get the post content according to the chosen kind of delivery
if($atts['excerpt']) {
// content of shortcodes should be displayed
if (isset($atts['include_shortcodes']) && $atts['include_shortcodes'] == true) {
$html .= avada_custom_excerpt();
} else {
// content of shortcodes will be cut out, i.e. standard
$stripped_content = tf_content( $atts['excerpt_words'], $atts['strip_html'] );
$html .= $stripped_content;
}
} else {
global $more; $more = 0;
$content = get_the_content('');
$content = apply_filters('the_content', $content);
$content = str_replace(']]>', ']]>', $content);
$html .= $content;
}
$html .= '</div>
<div style="clear:both;"></div>';
if($atts['meta_all']) {
$html .= '<div class="meta-info">';
if($atts['layout'] == 'grid' || $atts['layout'] == 'timeline') {
if($atts['layout'] != 'large alternate' && $atts['layout'] != 'medium alternate') {
$html .= '<div class="alignleft">';
if($atts['meta_link']) {
$html .= '<a href="' .get_permalink() .'" class="read-more">' .__("Read More", "Avada") .'</a>';
}
$html .= '</div>';
}
$html .= '<div class="alignright">';
if($atts['meta_comments']) {
ob_start();
comments_popup_link('<i class="icon-comments"></i> '.__('0', 'Avada'), '<i class="icon-comments"></i> '.__('1', 'Avada'), '<i class="icon-comments"></i> '.'%');
$html .= ob_get_clean();
}
$html .= '</div>';
} else {
if($atts['layout'] != 'large alternate' && $atts['layout'] != 'medium alternate') {
示例6: render
/**
* Render the parent shortcode
* @param array $args Shortcode paramters
* @param string $content Content between shortcode
* @return string HTML output
*/
function render($args, $content = '')
{
global $smof_data;
$defaults = FusionCore_Plugin::set_shortcode_defaults(array('class' => '', 'id' => '', 'cat_slug' => '', 'columns' => 3, 'exclude_cats' => '', 'excerpt_length' => '', 'excerpt_words' => '15', 'filters' => 'yes', 'layout' => 'carousel', 'number_posts' => 8, 'animation_direction' => 'left', 'animation_speed' => '', 'animation_type' => '', 'picture_size' => 'fixed'), $args);
$defaults['filters'] == 'yes' || $defaults['filters'] == 'true' ? $defaults['filters'] = true : ($defaults['filters'] = false);
extract($defaults);
self::$args = $defaults;
// set the image size for the slideshow
$this->set_image_size();
if ($excerpt_length || $excerpt_length === '0') {
$excerpt_words = $excerpt_length;
}
$args = array('post_type' => 'avada_portfolio', 'paged' => 1, 'posts_per_page' => $number_posts, 'has_password' => false);
if (self::$args['exclude_cats']) {
$cats_to_exclude = explode(',', self::$args['exclude_cats']);
} else {
$cats_to_exclude = '';
}
if (self::$args['cat_slug']) {
$cat_slugs = explode(',', self::$args['cat_slug']);
} else {
$cat_slugs = '';
}
if (isset($cats_to_exclude) && $cats_to_exclude) {
$args['tax_query'] = array(array('taxonomy' => 'portfolio_category', 'field' => 'slug', 'terms' => $cats_to_exclude, 'operator' => 'NOT IN'));
if ($cat_slugs) {
$args['tax_query']['relation'] = 'AND';
$args['tax_query'][] = array('taxonomy' => 'portfolio_category', 'field' => 'slug', 'terms' => $cat_slugs, 'operator' => 'IN');
}
} else {
if ($cat_slugs) {
$args['tax_query'] = array(array('taxonomy' => 'portfolio_category', 'field' => 'slug', 'terms' => $cat_slugs));
}
}
wp_reset_query();
$recent_works = new WP_Query($args);
$works = '';
while ($recent_works->have_posts()) {
$recent_works->the_post();
$item_classes = $terms = $image_wrapper = $item_content = $buttons = $url = '';
// set classes, link and target for the image extras content
$this->set_image_extras(get_the_ID());
if ($layout == 'carousel') {
if (has_post_thumbnail()) {
if ($smof_data['image_rollover']) {
$image = get_the_post_thumbnail(get_the_ID(), $this->image_size);
$image .= $this->get_image_extras(get_the_ID());
} else {
$image = sprintf('<a href="%s">%s</a>', get_permalink(get_the_ID()), get_the_post_thumbnail(get_the_ID(), $this->image_size));
}
$works .= sprintf('<li><div %s>%s</div></li>', FusionCore_Plugin::attributes('recentworks-shortcode-img-div'), $image);
}
} else {
if (has_post_thumbnail() || get_post_meta(get_the_ID(), 'pyre_video', true)) {
$item_cats = get_the_terms(get_the_ID(), 'portfolio_category');
if ($item_cats) {
foreach ($item_cats as $item_cat) {
$item_classes .= $item_cat->slug . ' ';
}
}
$permalink = get_permalink();
if (has_post_thumbnail()) {
$thumbnail = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()), $this->image_size);
$src = $thumbnail[0];
$alt = get_post_field('post_excerpt', get_post_thumbnail_id(get_the_ID()));
if ($smof_data['image_rollover']) {
$image = sprintf('<img %s />', FusionCore_Plugin::attributes('recentworks-shortcode-img', array('src' => $src, 'alt' => $alt)));
$image .= $this->get_image_extras(get_the_ID());
} else {
$image = sprintf('<a href="%s"><img %s /></a>', $permalink, FusionCore_Plugin::attributes('recentworks-shortcode-img', array('src' => $src, 'alt' => $alt)));
}
$image_wrapper = sprintf('<div %s>%s</div>', FusionCore_Plugin::attributes('recentworks-shortcode-img-div'), $image);
}
if ($layout == 'grid-with-excerpts') {
$stripped_content = strip_shortcodes(tf_content($excerpt_words, $smof_data['strip_html_excerpt']));
if ($columns == 1) {
if (get_post_meta(get_the_ID(), 'pyre_project_url', true)) {
$url = sprintf('<a href="%s" %s>%s</a>', get_post_meta(get_the_ID(), 'pyre_project_url', true), FusionCore_Plugin::attributes('fusion-button medium default'), __('View Project', 'Avada'));
}
$buttons = sprintf('<div %s><a href="%s" %s>%s</a>%s</div>', FusionCore_Plugin::attributes('buttons'), $permalink, FusionCore_Plugin::attributes('fusion-button medium default'), __('Learn More', 'Avada'), $url);
}
$item_content = sprintf('<div %s><h2><a href="%s">%s</a></h2><h4>%s</h4>%s</div>', FusionCore_Plugin::attributes('portfolio-content'), $permalink, get_the_title(), get_the_term_list(get_the_ID(), 'portfolio_category', '', ', ', ''), $stripped_content);
}
$works .= sprintf('<div %s>%s%s</div>', FusionCore_Plugin::attributes('portfolio-item ' . $item_classes), $image_wrapper, $item_content);
}
}
}
wp_reset_query();
if ($layout == 'carousel') {
$html = sprintf('<div %s><div %s><div %s><ul>%s</ul></div><div %s><span %s></span><span %s></span></div></div></div>', FusionCore_Plugin::attributes('recentworks-shortcode'), FusionCore_Plugin::attributes('es-carousel-wrapper fusion-carousel-large'), FusionCore_Plugin::attributes('es-carousel'), $works, FusionCore_Plugin::attributes('es-nav'), FusionCore_Plugin::attributes('es-nav-prev'), FusionCore_Plugin::attributes('es-nav-next'));
} else {
$portfolio_category = get_terms('portfolio_category');
$filter = '';
$filter_wrapper = '';
//.........这里部分代码省略.........
示例7: blog_shortcode
//.........这里部分代码省略.........
if (has_post_thumbnail() || get_post_meta(get_the_ID(), 'pyre_video', true)) {
$html .= '<div class="flexslider blog-medium-image floated-post-slideshow">
<ul class="slides">';
if (get_post_meta(get_the_ID(), 'pyre_video', true)) {
$html .= '<li class="full-video">' . get_post_meta(get_the_ID(), 'pyre_video', true) . '</li>';
}
if (has_post_thumbnail(get_the_ID())) {
$full_image = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()), 'full');
$attachment_data = wp_get_attachment_metadata(get_post_thumbnail_id(get_the_ID()));
$html .= '<li>
<div class="image">
<a href="' . get_permalink() . '">' . get_the_post_thumbnail(get_the_ID(), "blog-medium") . '</a>
<div class="image-extras">
<div class="image-extras-content">';
$full_image = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()), 'full');
$html .= '<a style="' . $link_icon_css . '" class="icon link-icon" href="' . $icon_permalink . '">Permalink</a>';
if (get_post_meta(get_the_ID(), 'pyre_video_url', true)) {
$full_image[0] = get_post_meta(get_the_ID(), 'pyre_video_url', true);
}
$html .= '<a style="' . $zoom_icon_css . '" class="icon gallery-icon" href="' . $full_image[0] . '" rel="prettyPhoto[gallery' . get_the_ID() . ']">Gallery</a>
<h3>' . get_the_title() . '</h3>
</div>
</div>
</div>
</li>';
}
if ($data['posts_slideshow']) {
$i = 2;
while ($i <= $data['posts_slideshow_number']) {
$new_attachment_id = kd_mfi_get_featured_image_id('featured-image-' . $i, 'post', get_the_ID());
if ($new_attachment_id) {
$attachment_image = wp_get_attachment_image_src($new_attachment_id, 'blog-medium');
$full_image = wp_get_attachment_image_src($new_attachment_id, 'full');
$attachment_data = wp_get_attachment_metadata($new_attachment_id);
$html .= '<li>
<div class="image">
<a href="' . get_permalink() . '"><img src="' . $attachment_image[0] . '" alt="' . get_post_field('post_excerpt', $new_attachment_id) . '" /></a>
<a style="display:none;" href="' . $full_image[0] . '" rel="prettyPhoto[gallery' . get_the_ID() . ']" alt="' . get_post_field('post_excerpt', $new_attachment_id) . '" title="' . get_post_field('post_content', $new_attachment_id) . '"><img style="display:none;" alt="' . get_post_field('post_excerpt', $new_attachment_id) . '" /></a>
</div>
</li>';
}
$i++;
}
}
$html .= '</ul>
</div>';
}
}
}
$html .= '<h2><a href="' . get_permalink() . '">' . get_the_title() . '</a></h2>
<div class="post-content">
';
if ($data['content_length'] == 'Excerpt') {
// content of shortcodes should be displayed
if (isset($atts['include_shortcodes']) && $atts['include_shortcodes'] == true) {
$html .= custom_excerpt();
} else {
// content of shortcodes will be cut out, i.e. standard
$stripped_content = tf_content($data['excerpt_length_blog'], $data['strip_html_excerpt']);
$html .= $stripped_content;
}
} else {
$html .= get_the_content('');
}
$html .= '</div><div class="clearboth"></div>';
} else {
$html .= '<h2><a href="' . get_permalink() . '">' . get_the_title() . '</a></h2>';
}
if ($data['post_meta']) {
$html .= '<div class="meta-info">
<div class="alignleft">' . __('By', 'Avada') . ' ';
ob_start();
the_author_posts_link();
$html .= ob_get_clean() . '<span class="sep">|</span>' . get_the_time($data['date_format']) . '<span class="sep">|</span>';
ob_start();
the_category(', ');
$html .= ob_get_clean();
$html .= '<span class="sep">|</span>';
ob_start();
comments_popup_link(__('0 Comments', 'Avada'), __('1 Comment', 'Avada'), '% ' . __('Comments', 'Avada'));
$html .= ob_get_clean() . '</div>
<div class="alignright">
<a href="' . get_permalink() . '" class="read-more">' . __('Read More', 'Avada') . '</a>
</div>
</div>';
}
$html .= '</div>';
}
$html .= '<div><div>';
//no paging if only the latest posts are shown
if (isset($get_latest) && $get_latest > 0) {
wp_reset_query();
return $html;
} else {
$html .= ml_blog_pagination($ml_query, $pages = '', $range = 2);
wp_reset_query();
return $html;
}
}
示例8: loop_content
function loop_content()
{
// get the post content according to the chosen kind of delivery
if (self::$args['excerpt']) {
$content = tf_content(self::$args['excerpt_words'], self::$args['strip_html']);
} else {
$content = get_the_content();
$content = apply_filters('the_content', $content);
$content = str_replace(']]>', ']]>', $content);
}
echo $content;
}
示例9: posts_excerpt
function posts_excerpt()
{
$html = '';
$args = array('posts_per_page' => self::$args['limit'], 'meta_query' => array(array('key' => '_thumbnail_id')));
if (self::$args['post_id']) {
$post_ids = explode(',', self::$args['post_id']);
$args['post__in'] = $post_ids;
}
if (self::$args['category']) {
$args['category_name'] = self::$args['category'];
}
$query = new WP_Query($args);
if ($query->have_posts()) {
while ($query->have_posts()) {
$query->the_post();
$image = wp_get_attachment_url(get_post_thumbnail_id());
$title = get_post_field('post_excerpt', get_post_thumbnail_id());
$alt = get_the_title();
$image_output = sprintf('<img src="%s" alt="%s" />', $image, get_the_title());
$link_output = sprintf('<a href="%s">%s</a>', get_permalink(), $image_output);
$title = sprintf('<h2><a href="%s">%s</a></h2>', get_permalink(), get_the_title());
$excerpt = sprintf('%s', tf_content(self::$args['excerpt'], true));
$container = sprintf('<div %s><div %s>%s</div></div>', FusionCore_Plugin::attributes('flexslider-shortcode-title-container'), FusionCore_Plugin::attributes('excerpt-container'), $title . $excerpt);
$html .= sprintf('<li>%s</li>', $link_output . $container);
}
} else {
}
wp_reset_query();
return $html;
}
示例10: slideshow_type_posts
/**
* Get the slides for the "posts" slideshow type.
* @since 1.0.0
* @param array $args Array of arguments to determine which slides to return.
* @return array An array of slides to render for the slideshow.
*/
private function slideshow_type_posts($args = array(), $settings = array())
{
global $post;
$slides = array();
$defaults = array('limit' => '5', 'category' => '', 'tag' => '', 'layout' => 'text-left', 'size' => 'large', 'link_title' => '', 'overlay' => 'none', 'display_excerpt' => 'true');
$args = wp_parse_args($args, $defaults);
// Determine and validate the layout type.
$supported_layouts = WooSlider_Utils::get_posts_layout_types();
if (!in_array($args['layout'], array_keys($supported_layouts))) {
$args['layout'] = $defaults['layout'];
}
// Determine and validate the overlay setting.
if (!in_array($args['overlay'], array('none', 'full', 'natural'))) {
$args['overlay'] = $defaults['overlay'];
}
$query_args = array('post_type' => 'post', 'numberposts' => intval($args['limit']));
if ($args['category'] != '') {
$query_args['category_name'] = esc_attr($args['category']);
}
if ($args['tag'] != '') {
$query_args['tag'] = esc_attr(str_replace(',', '+', $args['tag']));
}
$posts = get_posts($query_args);
if (!is_wp_error($posts) && count($posts) > 0) {
// Setup the CSS class.
$class = 'layout-' . esc_attr($args['layout']) . ' overlay-' . esc_attr($args['overlay']);
foreach ($posts as $k => $post) {
setup_postdata($post);
$image = get_the_post_thumbnail(get_the_ID(), $args['size']);
// Allow plugins/themes to filter here.
$excerpt = '';
if ($args['display_excerpt'] == 'true' || $args['display_excerpt'] == 1) {
$excerpt = wpautop(tf_content($args['excerpt'], "true"));
}
$title = get_the_title(get_the_ID());
if ($args['link_title'] == 'true' || $args['link_title'] == 1) {
$title = '<a href="' . get_permalink($post) . '">' . $title . '</a>';
$image = '<a href="' . get_permalink($post) . '">' . $image . '</a>';
}
$content = $image . '<div class="slide-excerpt"><h2 class="slide-title">' . $title . '</h2>' . $excerpt . '</div>';
if ($args['layout'] == 'text-top') {
$content = '<div class="slide-excerpt"><h2 class="slide-title">' . $title . '</h2>' . $excerpt . '</div>' . $image;
}
$layed_out_content = apply_filters('wooslider_posts_layout_html', $content, $args, $post);
$content = '<div class="' . esc_attr($class) . '">' . $layed_out_content . '</div>';
$data = array('content' => $content);
if (isset($args['thumbnails']) && ('true' == $args['thumbnails'] || 1 == $args['thumbnails'])) {
$thumb_url = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()), 'medium');
if (!is_bool($thumb_url) && isset($thumb_url[0])) {
$data['attributes'] = array('data-thumb' => esc_url($thumb_url[0]));
} else {
$data['attributes'] = array('data-thumb' => esc_url(WooSlider_Utils::get_placeholder_image()));
}
}
$slides[] = $data;
}
wp_reset_postdata();
}
return $slides;
}
示例11: tf_content
} else {
?>
<div class="content-sep"></div>
<?php
}
?>
<?php
if (!$smof_data['search_excerpt']) {
?>
<?php
if (get_post_type(get_the_ID()) != 'page') {
$stripped_content = tf_content($smof_data['excerpt_length_blog'], $smof_data['strip_html_excerpt']);
echo $stripped_content;
} else {
$stripped_content = tf_content(55, $smof_data['strip_html_excerpt']);
echo $stripped_content;
}
?>
<?php
}
?>
<?php
if ($smof_data['post_meta'] && !$smof_data['post_meta_tags'] && ($smof_data['search_layout'] == 'Large' || $smof_data['search_layout'] == 'Medium' || $smof_data['search_layout'] == 'Grid' || $smof_data['search_layout'] == 'Timeline')) {
?>
<div class="meta-tags bottom"><?php
the_tags();
?>
</div>
<?php
}