本文整理汇总了PHP中avada_render_rich_snippets_for_pages函数的典型用法代码示例。如果您正苦于以下问题:PHP avada_render_rich_snippets_for_pages函数的具体用法?PHP avada_render_rich_snippets_for_pages怎么用?PHP avada_render_rich_snippets_for_pages使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了avada_render_rich_snippets_for_pages函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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' => '', 'boxed_text' => 'unboxed', 'cat_slug' => '', 'column_spacing' => '12', 'columns' => 3, 'exclude_cats' => '', 'excerpt_length' => '', 'excerpt_words' => '15', 'filters' => 'yes', 'layout' => 'carousel', 'number_posts' => 8, 'picture_size' => 'fixed', 'animation_direction' => 'left', 'animation_speed' => '', 'animation_type' => ''), $args);
$defaults['filters'] == 'yes' || $defaults['filters'] == 'true' ? $defaults['filters'] = true : ($defaults['filters'] = false);
if ($defaults['column_spacing'] === '0') {
$defaults['column_spacing'] = '0.0';
}
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 = array();
}
if (self::$args['cat_slug']) {
$cat_slugs = explode(',', self::$args['cat_slug']);
} else {
$cat_slugs = array();
}
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();
$rich_snippets = $entry_title = $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>%s<div %s>%s</div></li>', avada_render_rich_snippets_for_pages(), FusionCore_Plugin::attributes('recentworks-shortcode-img-div'), $image);
}
} else {
if (has_post_thumbnail() || get_post_meta(get_the_ID(), 'pyre_video', true)) {
$item_classes = 'portfolio-' . $boxed_text . ' ';
$item_cats = get_the_terms(get_the_ID(), 'portfolio_category');
if ($item_cats) {
foreach ($item_cats as $item_cat) {
$item_classes .= $item_cat->slug . ' ';
}
}
if ($column_spacing) {
$item_classes .= ' col-spacing';
}
$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_meta(get_post_thumbnail_id(get_the_ID()), '_wp_attachment_image_alt', true);
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') {
$rich_snippets = avada_render_rich_snippets_for_pages(false);
if (!$smof_data['disable_date_rich_snippet_pages']) {
$entry_title = 'entry-title';
}
$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', 'fusion-core'));
}
$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', 'fusion-core'), $url);
}
$item_content = sprintf('<div %s><h2 class="%s"><a href="%s">%s</a></h2><h4>%s</h4>%s</div>', FusionCore_Plugin::attributes('portfolio-content'), $entry_title, $permalink, get_the_title(), get_the_term_list(get_the_ID(), 'portfolio_category', '', ', ', ''), $stripped_content);
} else {
//.........这里部分代码省略.........
示例2: the_title
echo ' class="entry-title"';
}
?>
><a href="<?php
echo $permalink;
?>
"><?php
the_title();
?>
</a></h2>
<h4><?php
echo get_the_term_list($post->ID, 'portfolio_category', '', ', ', '');
?>
</h4>
<?php
echo avada_render_rich_snippets_for_pages(false);
?>
<?php
if ($smof_data['portfolio_text_layout']) {
?>
<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'];
}
示例3: 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' => '', 'autoplay' => 'no', 'boxed_text' => 'unboxed', 'cat_slug' => '', 'carousel_layout' => 'title_on_rollover', 'column_spacing' => '12', 'columns' => 3, 'exclude_cats' => '', 'excerpt_length' => '15', 'excerpt_words' => '', 'filters' => 'yes', 'layout' => 'carousel', 'mouse_scroll' => 'no', 'number_posts' => 8, 'offset' => '', 'picture_size' => 'fixed', 'scroll_items' => '', 'show_nav' => 'yes', 'strip_html' => 'yes', 'animation_direction' => 'left', 'animation_speed' => '', 'animation_type' => ''), $args);
if ($defaults['column_spacing'] === '0') {
$defaults['column_spacing'] = '0.0';
}
if ($defaults['strip_html'] == 'yes') {
$defaults['strip_html'] = TRUE;
}
extract($defaults);
self::$args = $defaults;
// Set the image size for the slideshow
$this->set_image_size();
// As $excerpt_words is deprecated, only use it when explicity set
if ($excerpt_words || $excerpt_words === '0') {
$excerpt_length = $excerpt_words;
}
// Transform $cat_slugs to array
if (self::$args['cat_slug']) {
$cat_slugs = preg_replace('/\\s+/', '', self::$args['cat_slug']);
$cat_slugs = explode(',', self::$args['cat_slug']);
} else {
$cat_slugs = array();
}
// Transform $cats_to_exclude to array
if (self::$args['exclude_cats']) {
$cats_to_exclude = preg_replace('/\\s+/', '', self::$args['cat_slug']);
$cats_to_exclude = explode(',', self::$args['exclude_cats']);
} else {
$cats_to_exclude = array();
}
// Initialize the query array
$args = array('post_type' => 'avada_portfolio', 'paged' => 1, 'posts_per_page' => $number_posts, 'has_password' => false);
if ($defaults['offset']) {
$args['offset'] = $offset;
}
// Check if the are categories that should be excluded
if (!empty($cats_to_exclude)) {
// Exclude the correct cats from tax_query
$args['tax_query'] = array(array('taxonomy' => 'portfolio_category', 'field' => 'slug', 'terms' => $cats_to_exclude, 'operator' => 'NOT IN'));
// Include the correct cats in tax_query
if (!empty($cat_slugs)) {
$args['tax_query']['relation'] = 'AND';
$args['tax_query'][] = array('taxonomy' => 'portfolio_category', 'field' => 'slug', 'terms' => $cat_slugs, 'operator' => 'IN');
}
} else {
// Include the cats from $cat_slugs in tax_query
if (!empty($cat_slugs)) {
$args['tax_query'] = array(array('taxonomy' => 'portfolio_category', 'field' => 'slug', 'terms' => $cat_slugs));
}
}
// If placeholder images are disabled, add the _thumbnail_id meta key to the query to only retrieve posts with featured images
if (!$smof_data['featured_image_placeholder']) {
$args['meta_key'] = '_thumbnail_id';
}
wp_reset_query();
$recent_works = new WP_Query($args);
$portfolio_posts = '';
// Loop through returned posts
// Setup the inner HTML for each elements
while ($recent_works->have_posts()) {
$recent_works->the_post();
// Reset vars
$rich_snippets = $post_classes = $title_terms = $image = $post_title = $post_terms = $separator = $post_content = $buttons = $view_project_button = '';
// For carousels we only need the image and a li wrapper
if ($layout == 'carousel') {
// Title on rollover layout
if ($carousel_layout == 'title_on_rollover') {
$show_title = 'default';
// Title below image layout
} else {
$show_title = 'disable';
// Get the post title
$title_terms .= sprintf('<h4 %s><a href="%s" target="%s">%s</a></h4>', FusionCore_Plugin::attributes('fusion-carousel-title'), get_permalink(get_the_ID()), '_self', get_the_title());
// Get the terms
$title_terms .= get_the_term_list(get_the_ID(), 'portfolio_category', '<div class="fusion-carousel-meta">', ', ', '</div>');
}
// Render the video set in page options if no featured image is present
if (!has_post_thumbnail() && fusion_get_page_option('video', get_the_ID())) {
$video_max_width = '540px';
$image = sprintf('<div class="fusion-image-wrapper fusion-video" style="max-width:%s;">%s</div>', $video_max_width, fusion_get_page_option('video', get_the_ID()));
} else {
// Get the post image
$image = avada_render_first_featured_image_markup(get_the_ID(), $this->image_size, get_permalink(get_the_ID()), TRUE, FALSE, FALSE, 'disable', $show_title, '', $this->recent_works_counter);
}
$portfolio_posts .= sprintf('<li %s><div %s>%s%s%s</div></li>', FusionCore_Plugin::attributes('fusion-carousel-item'), FusionCore_Plugin::attributes('fusion-carousel-item-wrapper'), avada_render_rich_snippets_for_pages(), $image, $title_terms);
} else {
// Get the post permalink
$permalink = get_permalink();
// Include the post categories as css classes for later useage with filters
$post_categories = get_the_terms(get_the_ID(), 'portfolio_category');
if ($post_categories) {
foreach ($post_categories as $post_category) {
//.........这里部分代码省略.........
示例4: avada_render_post_metadata
/**
* Render the full meta data for blog archive and single layouts
* @param string $layout The blog layout (either single, standard, alternate or grid_timeline)
*
* @return string HTML markup to display the date and post format box
**/
function avada_render_post_metadata($layout, $settings = array())
{
$html = $author = $date = $metadata = '';
if (!$settings) {
$settings['post_meta'] = Avada()->settings->get('post_meta');
$settings['post_meta_author'] = Avada()->settings->get('post_meta_author');
$settings['post_meta_date'] = Avada()->settings->get('post_meta_date');
$settings['post_meta_cats'] = Avada()->settings->get('post_meta_cats');
$settings['post_meta_tags'] = Avada()->settings->get('post_meta_tags');
$settings['post_meta_comments'] = Avada()->settings->get('post_meta_comments');
}
// Check if meta data is enabled
if ($settings['post_meta'] && get_post_meta(get_queried_object_id(), 'pyre_post_meta', TRUE) != 'no' || !$settings['post_meta'] && get_post_meta(get_queried_object_id(), 'pyre_post_meta', TRUE) == 'yes') {
// For alternate, grid and timeline layouts return empty single-line-meta if all meta data for that position is disabled
if (($layout == 'alternate' || $layout == 'grid_timeline') && $settings['post_meta_author'] && $settings['post_meta_date'] && $settings['post_meta_cats'] && $settings['post_meta_tags'] && $settings['post_meta_comments']) {
return $html;
}
// Render author meta data
if (!$settings['post_meta_author']) {
ob_start();
the_author_posts_link();
$author_post_link = ob_get_clean();
// Check if rich snippets are enabled
if (Avada()->settings->get('disable_date_rich_snippet_pages')) {
$metadata .= sprintf('%s <span>%s</span><span class="fusion-inline-sep">|</span>', __('By', 'Avada'), $author_post_link);
} else {
$metadata .= sprintf('%s <span class="vcard"><span class="fn">%s</span></span><span class="fusion-inline-sep">|</span>', __('By', 'Avada'), $author_post_link);
}
// If author meta data won't be visible, render just the invisible author rich snippet
} else {
$author .= avada_render_rich_snippets_for_pages(FALSE, TRUE, FALSE);
}
// Render the updated meta data or at least the rich snippet if enabled
if (!$settings['post_meta_date']) {
$metadata .= avada_render_rich_snippets_for_pages(FALSE, FALSE, TRUE);
$metadata .= sprintf('<span>%s</span><span class="fusion-inline-sep">|</span>', get_the_time(Avada()->settings->get('date_format')));
} else {
$date .= avada_render_rich_snippets_for_pages(FALSE, FALSE, TRUE);
}
// Render rest of meta data
if ($layout != 'grid_timeline') {
// Render categories
if (!$settings['post_meta_cats']) {
ob_start();
the_category(', ');
$categories = ob_get_clean();
if ($categories) {
if (!$settings['post_meta_tags']) {
$metadata .= __('Categories:', 'Avada') . ' ';
}
$metadata .= sprintf('%s<span class="fusion-inline-sep">|</span>', $categories);
}
}
// Render tags
if (!$settings['post_meta_tags']) {
ob_start();
the_tags('');
$tags = ob_get_clean();
if ($tags) {
$metadata .= sprintf('<span class="meta-tags">%s %s</span><span class="fusion-inline-sep">|</span>', __('Tags:', 'Avada'), $tags);
}
}
// Render comments
if (!$settings['post_meta_comments']) {
ob_start();
comments_popup_link(__('0 Comments', 'Avada'), __('1 Comment', 'Avada'), '% ' . __('Comments', 'Avada'));
$comments = ob_get_clean();
$metadata .= sprintf('<span class="fusion-comments">%s</span>', $comments);
}
}
// Render the HTML wrappers for the different layouts
if ($metadata) {
$metadata = $author . $date . $metadata;
if ($layout == 'single') {
$html .= sprintf('<div class="fusion-meta-info"><div class="fusion-meta-info-wrapper">%s</div></div>', $metadata);
} elseif ($layout == 'alternate' || $layout == 'grid_timeline') {
$html .= sprintf('<p class="fusion-single-line-meta">%s</p>', $metadata);
} else {
$html .= sprintf('<div class="fusion-alignleft">%s</div>', $metadata);
}
} else {
$html .= $author . $date;
}
// Render author and updated rich snippets for grid and timeline layouts
} else {
if (!Avada()->settings->get('disable_date_rich_snippet_pages')) {
$html .= avada_render_rich_snippets_for_pages(FALSE);
}
}
return $html;
}
示例5: render
//.........这里部分代码省略.........
self::$args = $defaults;
$recent_posts = new WP_Query($args);
$count = 1;
while ($recent_posts->have_posts()) {
$recent_posts->the_post();
$attachment = $date_box = $slideshow = $slides = $content = '';
if ($layout == 'date-on-side') {
switch (get_post_format()) {
case 'gallery':
$format_class = 'images';
break;
case 'link':
$format_class = 'link';
break;
case 'image':
$format_class = 'image';
break;
case 'quote':
$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('fusion-date-and-formats'), FusionCore_Plugin::attributes('fusion-date-box updated'), FusionCore_Plugin::attributes('fusion-date'), get_the_time($smof_data['alternate_date_format_day']), FusionCore_Plugin::attributes('fusion-month-year'), get_the_time($smof_data['alternate_date_format_month_year']), FusionCore_Plugin::attributes('fusion-format-box'), FusionCore_Plugin::attributes('fusion-icon-' . $format_class));
}
if ($thumbnail == 'yes' && $layout != 'date-on-side' && !post_password_required(get_the_ID())) {
if ($layout == 'default') {
$image_size = 'recent-posts';
} elseif ($layout == 'thumbnails-on-side') {
$image_size = 'portfolio-five';
}
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)));
}
$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 .= avada_render_rich_snippets_for_pages(false);
$entry_title = '';
if (!$smof_data['disable_date_rich_snippet_pages']) {
$entry_title = 'entry-title';
}
$content .= sprintf('<h4 class="%s"><a href="%s">%s</a></h4>', $entry_title, get_permalink(get_the_ID()), get_the_title());
} else {
$content .= avada_render_rich_snippets_for_pages();
}
if ($meta == 'yes') {
$comments = $comments_link = '';
ob_start();
comments_popup_link(__('0 Comments', 'fusion-core'), __('1 Comment', 'fusion-core'), '% ' . __('Comments', 'fusion-core'));
$comments_link = ob_get_contents();
ob_get_clean();
$comments = sprintf('<span %s>|</span><span>%s</span>', FusionCore_Plugin::attributes('meta-separator'), $comments_link);
$content .= sprintf('<p %s><span><span %s>%s</span></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 .= fusion_get_post_content('', 'yes', $excerpt_words, $strip_html);
}
if ($count == self::$args['columns']) {
$count = 0;
$items .= sprintf('<div %s>%s%s<div %s>%s</div></div><div class="fusion-clearfix"></div>', FusionCore_Plugin::attributes('recentposts-shortcode-column'), $date_box, $slideshow, FusionCore_Plugin::attributes('recent-posts-content'), $content);
} else {
$items .= sprintf('<div %s>%s%s<div %s>%s</div></div>', FusionCore_Plugin::attributes('recentposts-shortcode-column'), $date_box, $slideshow, FusionCore_Plugin::attributes('recent-posts-content'), $content);
}
$count++;
}
$html = sprintf('<div %s><section %s>%s</section></div>', FusionCore_Plugin::attributes('recentposts-shortcode'), FusionCore_Plugin::attributes('recentposts-shortcode-section'), $items);
wp_reset_query();
return $html;
}
示例6: avada_render_post_metadata
/**
* Render the full meta data for blog archive and single layouts
* @param string $layout The blog layout (either single, standard, alternate or grid_timeline)
*
* @return string HTML markup to display the date and post format box
**/
function avada_render_post_metadata($layout, $settings = array())
{
$html = $author = $date = $metadata = '';
$settings = is_array($settings) ? $settings : array();
$default_settings = array('post_meta' => Avada()->settings->get('post_meta'), 'post_meta_author' => Avada()->settings->get('post_meta_author'), 'post_meta_date' => Avada()->settings->get('post_meta_date'), 'post_meta_cats' => Avada()->settings->get('post_meta_cats'), 'post_meta_tags' => Avada()->settings->get('post_meta_tags'), 'post_meta_comments' => Avada()->settings->get('post_meta_comments'));
$settings = wp_parse_args($settings, $default_settings);
// Check if meta data is enabled
if ($settings['post_meta'] && 'no' != get_post_meta(get_queried_object_id(), 'pyre_post_meta', true) || !$settings['post_meta'] && 'yes' == get_post_meta(get_queried_object_id(), 'pyre_post_meta', true)) {
// For alternate, grid and timeline layouts return empty single-line-meta if all meta data for that position is disabled
if (in_array($layout, array('alternate', 'grid_timeline')) && !$settings['post_meta_author'] && !$settings['post_meta_date'] && !$settings['post_meta_cats'] && !$settings['post_meta_tags'] && !$settings['post_meta_comments']) {
return '';
}
// Render author meta data
if ($settings['post_meta_author']) {
ob_start();
the_author_posts_link();
$author_post_link = ob_get_clean();
// Check if rich snippets are enabled
if (!Avada()->settings->get('disable_date_rich_snippet_pages')) {
$metadata .= sprintf(esc_html__('By %s', 'Avada'), '<span>' . $author_post_link . '</span>');
} else {
$metadata .= sprintf(esc_html__('By %s', 'Avada'), '<span class="vcard"><span class="fn">' . $author_post_link . '</span></span>');
}
$metadata .= '<span class="fusion-inline-sep">|</span>';
// If author meta data won't be visible, render just the invisible author rich snippet
} else {
$author .= avada_render_rich_snippets_for_pages(false, true, false);
}
// Render the updated meta data or at least the rich snippet if enabled
if ($settings['post_meta_date']) {
$metadata .= avada_render_rich_snippets_for_pages(false, false, true);
$metadata .= '<span>' . get_the_time(Avada()->settings->get('date_format')) . '</span><span class="fusion-inline-sep">|</span>';
} else {
$date .= avada_render_rich_snippets_for_pages(false, false, true);
}
// Render rest of meta data
// Render categories
if ($settings['post_meta_cats']) {
ob_start();
the_category(', ');
$categories = ob_get_clean();
if ($categories) {
$metadata .= $settings['post_meta_tags'] ? sprintf(esc_html__('Categories: %s', 'Avada'), $categories) : $categories;
$metadata .= '<span class="fusion-inline-sep">|</span>';
}
}
// Render tags
if ($settings['post_meta_tags']) {
ob_start();
the_tags('');
$tags = ob_get_clean();
if ($tags) {
$metadata .= '<span class="meta-tags">' . sprintf(esc_html__('Tags: %s', 'Avada'), $tags) . '</span><span class="fusion-inline-sep">|</span>';
}
}
// Render comments
if ($settings['post_meta_comments'] && $layout != 'grid_timeline') {
ob_start();
comments_popup_link(esc_html__('0 Comments', 'Avada'), esc_html__('1 Comment', 'Avada'), esc_html__('% Comments', 'Avada'));
$comments = ob_get_clean();
$metadata .= '<span class="fusion-comments">' . $comments . '</span>';
}
// Render the HTML wrappers for the different layouts
if ($metadata) {
$metadata = $author . $date . $metadata;
if ('single' == $layout) {
$html .= '<div class="fusion-meta-info"><div class="fusion-meta-info-wrapper">' . $metadata . '</div></div>';
} elseif (in_array($layout, array('alternate', 'grid_timeline'))) {
$html .= '<p class="fusion-single-line-meta">' . $metadata . '</p>';
} else {
$html .= '<div class="fusion-alignleft">' . $metadata . '</div>';
}
} else {
$html .= $author . $date;
}
// Render author and updated rich snippets for grid and timeline layouts
} else {
if (Avada()->settings->get('disable_date_rich_snippet_pages')) {
$html .= avada_render_rich_snippets_for_pages(false);
}
}
return $html;
}
示例7: avada_render_post_metadata
function avada_render_post_metadata($layout)
{
global $smof_data;
$html = $metadata = '';
if ($smof_data['post_meta'] && get_post_meta(get_queried_object_id(), 'pyre_post_meta', true) != 'no' || !$smof_data['post_meta'] && get_post_meta(get_queried_object_id(), 'pyre_post_meta', true) == 'yes') {
if (($layout == 'alternate' || $layout == 'grid_timeline') && $smof_data['post_meta_author'] && $smof_data['post_meta_date'] && $smof_data['post_meta_cats'] && $smof_data['post_meta_tags'] && $smof_data['post_meta_comments']) {
return $html;
}
if (!$smof_data['post_meta_author']) {
ob_start();
the_author_posts_link();
$author_post_link = ob_get_clean();
if ($smof_data['disable_date_rich_snippet_pages']) {
$metadata .= sprintf('%s <span>%s</span><span class="sep">|</span>', __('By', 'Avada'), $author_post_link);
} else {
$metadata .= sprintf('%s <span class="vcard"><span class="fn">%s</span></span><span class="sep">|</span>', __('By', 'Avada'), $author_post_link);
}
} else {
$metadata .= avada_render_rich_snippets_for_pages(false, true, false);
}
if (!$smof_data['post_meta_date']) {
$metadata .= avada_render_rich_snippets_for_pages(false, false, true);
$metadata .= sprintf('<span>%s</span><span class="sep">|</span>', get_the_time($smof_data['date_format']));
} else {
$metadata .= avada_render_rich_snippets_for_pages(false, false, true);
}
if ($layout != 'grid_timeline') {
if (!$smof_data['post_meta_cats']) {
ob_start();
the_category(', ');
$categories = ob_get_clean();
if ($categories) {
if (!$smof_data['post_meta_tags']) {
$metadata .= __('Categories:', 'Avada') . ' ';
}
$metadata .= sprintf('%s<span class="sep">|</span>', $categories);
}
}
if (!$smof_data['post_meta_tags']) {
ob_start();
the_tags('');
$tags = ob_get_clean();
if ($tags) {
$metadata .= sprintf('<span class="meta-tags">%s %s</span><span class="sep">|</span>', __('Tags:', 'Avada'), $tags);
}
}
if (!$smof_data['post_meta_comments']) {
ob_start();
comments_popup_link(__('0 Comments', 'Avada'), __('1 Comment', 'Avada'), '% ' . __('Comments', 'Avada'));
$comments = ob_get_clean();
$metadata .= sprintf('<span class="comments">%s</span>', $comments);
}
}
if ($layout == 'single') {
$html .= sprintf('<div class="meta-info"><div class="meta-info-wrapper">%s</div></div>', $metadata);
} elseif ($layout == 'alternate' || $layout == 'grid_timeline') {
$html .= sprintf('<p class="single-line-meta">%s</p>', $metadata);
} else {
$html .= sprintf('<div class="alignleft">%s</div>', $metadata);
}
} else {
if (!$smof_data['disable_date_rich_snippet_pages']) {
$html .= avada_render_rich_snippets_for_pages(false);
}
}
return $html;
}