本文整理汇总了PHP中avia_backend_truncate函数的典型用法代码示例。如果您正苦于以下问题:PHP avia_backend_truncate函数的具体用法?PHP avia_backend_truncate怎么用?PHP avia_backend_truncate使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了avia_backend_truncate函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: avia_get_comment_list
function avia_get_comment_list($avia_new_query)
{
$time_format = apply_filters('avia_widget_time', get_option('date_format') . " - " . get_option('time_format'), 'avia_get_comment_list');
global $avia_config;
$comments = get_comments($avia_new_query);
if (!empty($comments)) {
echo '<ul class="news-wrap">';
foreach ($comments as $comment) {
if ($comment->comment_author != 'ActionScheduler') {
$gravatar_alt = esc_html($comment->comment_author);
echo '<li class="news-content">';
echo "<a class='news-link' title='" . get_the_title($comment->comment_post_ID) . "' href='" . get_comment_link($comment) . "'>";
echo "<span class='news-thumb'>";
echo get_avatar($comment, '48', '', $gravatar_alt);
echo "</span>";
echo "<strong class='news-headline'>" . avia_backend_truncate($comment->comment_content, 55, " ");
if ($time_format) {
echo "<span class='news-time'>" . get_comment_date($time_format, $comment->comment_ID) . " " . __('by', 'avia_framework') . " " . $comment->comment_author . "</span>";
}
echo "</strong>";
echo "</a>";
echo '</li>';
}
}
echo "</ul>";
wp_reset_postdata();
}
}
示例2: avia_post_nav
function avia_post_nav($same_category = false, $taxonomy = 'category')
{
global $wp_version;
$settings = array();
$settings['same_category'] = $same_category;
$settings['excluded_terms'] = '';
$settings['wpversion'] = $wp_version;
//dont display if a fullscreen slider is available since they overlap
if (class_exists('avia_sc_layerslider') && !empty(avia_sc_layerslider::$slide_count) || class_exists('avia_sc_slider_full') && !empty(avia_sc_slider_full::$slide_count)) {
$settings['is_fullwidth'] = true;
}
$settings['type'] = get_post_type();
$settings['taxonomy'] = $settings['type'] == 'portfolio' ? 'portfolio_entries' : $taxonomy;
if (!is_singular() || is_post_type_hierarchical($settings['type'])) {
$settings['is_hierarchical'] = true;
}
if ($settings['type'] === 'topic' || $settings['type'] === 'reply') {
$settings['is_bbpress'] = true;
}
$settings = apply_filters('avia_post_nav_settings', $settings);
if (!empty($settings['is_bbpress']) || !empty($settings['is_hierarchical']) || !empty($settings['is_fullwidth'])) {
return;
}
if (version_compare($settings['wpversion'], '3.8', '>=')) {
$entries['prev'] = get_previous_post($settings['same_category'], $settings['excluded_terms'], $settings['taxonomy']);
$entries['next'] = get_next_post($settings['same_category'], $settings['excluded_terms'], $settings['taxonomy']);
} else {
$entries['prev'] = get_previous_post($settings['same_category']);
$entries['next'] = get_next_post($settings['same_category']);
}
$entries = apply_filters('avia_post_nav_entries', $entries, $settings);
$output = "";
foreach ($entries as $key => $entry) {
if (empty($entry)) {
continue;
}
$the_title = isset($entry->av_custom_title) ? $entry->av_custom_title : avia_backend_truncate(get_the_title($entry->ID), 75, " ");
$link = isset($entry->av_custom_link) ? $entry->av_custom_link : get_permalink($entry->ID);
$image = isset($entry->av_custom_image) ? $entry->av_custom_image : get_the_post_thumbnail($entry->ID, 'thumbnail');
$tc1 = $tc2 = "";
$class = $image ? "with-image" : "without-image";
$output .= "<a class='avia-post-nav avia-post-{$key} {$class}' href='{$link}' >";
$output .= " <span class='label iconfont' " . av_icon_string($key) . "></span>";
$output .= " <span class='entry-info-wrap'>";
$output .= " <span class='entry-info'>";
$tc1 = " <span class='entry-title'>{$the_title}</span>";
if ($image) {
$tc2 = " <span class='entry-image'>{$image}</span>";
}
$output .= $key == 'prev' ? $tc1 . $tc2 : $tc2 . $tc1;
$output .= " </span>";
$output .= " </span>";
$output .= "</a>";
}
return $output;
}
示例3: avia_excerpt
/**
* Returns a post excerpt. depending on the order parameter the funciton will try to retrieve the excerpt from a different source
*/
function avia_excerpt($length = 250, $more_text = false, $order = array('more-tag', 'excerpt'))
{
$excerpt = "";
if ($more_text === false) {
$more_text = __('Read more', 'avia_framework');
}
foreach ($order as $method) {
if (!$excerpt) {
switch ($method) {
case 'more-tag':
global $more;
$more = 0;
$content = get_the_content($more_text);
$pos = strpos($content, 'class="more-link"');
if ($pos !== false) {
$excerpt = $content;
}
break;
case 'excerpt':
$post = get_post(get_the_ID());
if ($post->post_excerpt) {
$excerpt = get_the_excerpt();
} else {
$excerpt = preg_replace("!\\[.+?\\]!", "", get_the_excerpt());
// $excerpt = preg_replace("!\[.+?\]!", "", $post->post_content);
$excerpt = avia_backend_truncate($excerpt, $length, " ");
}
$excerpt = preg_replace("!\\s\\[...\\]\$!", '...', $excerpt);
break;
}
}
}
if ($excerpt) {
$excerpt = apply_filters('the_content', $excerpt);
$excerpt = str_replace(']]>', ']]>', $excerpt);
}
return $excerpt;
}
示例4: html
public function html()
{
global $avia_config;
$output = "";
if (empty($this->entries) || empty($this->entries->posts)) {
return $output;
}
avia_post_slider::$slide++;
extract($this->atts);
if ($preview_mode == 'auto') {
$image_size = 'portfolio';
}
$extraClass = 'first';
$grid = 'one_third';
$post_loop_count = 1;
$loop_counter = 1;
$autoplay = $autoplay == "no" ? false : true;
$total = $columns % 2 ? "odd" : "even";
switch ($columns) {
case "1":
$grid = 'av_fullwidth';
if ($preview_mode == 'auto') {
$image_size = 'large';
}
break;
case "2":
$grid = 'av_one_half';
break;
case "3":
$grid = 'av_one_third';
break;
case "4":
$grid = 'av_one_fourth';
if ($preview_mode == 'auto') {
$image_size = 'portfolio_small';
}
break;
case "5":
$grid = 'av_one_fifth';
if ($preview_mode == 'auto') {
$image_size = 'portfolio_small';
}
break;
}
$data = AviaHelper::create_data_string(array('autoplay' => $autoplay, 'interval' => $interval, 'animation' => $animation, 'show_slide_delay' => 90));
$thumb_fallback = "";
$markup = avia_markup_helper(array('context' => 'blog', 'echo' => false, 'custom_markup' => $custom_markup));
$output .= "<div {$data} class='avia-content-slider avia-content-{$type}-active avia-content-slider" . avia_post_slider::$slide . " avia-content-slider-{$total} {$class}' {$markup}>";
$output .= "<div class='avia-content-slider-inner'>";
foreach ($this->entries->posts as $entry) {
$the_id = $entry->ID;
$parity = $loop_counter % 2 ? 'odd' : 'even';
$last = $this->entries->post_count == $post_loop_count ? " post-entry-last " : "";
$post_class = "post-entry post-entry-{$the_id} slide-entry-overview slide-loop-{$post_loop_count} slide-parity-{$parity} {$last}";
$link = get_permalink($the_id);
$excerpt = "";
$title = '';
$show_meta = !is_post_type_hierarchical($entry->post_type);
$commentCount = get_comments_number($the_id);
$thumbnail = get_the_post_thumbnail($the_id, $image_size);
$format = get_post_format($the_id);
if (empty($format)) {
$format = "standard";
}
if ($thumbnail) {
$thumb_fallback = $thumbnail;
$thumb_class = "real-thumbnail";
} else {
$thumbnail = "<span class=' fallback-post-type-icon' " . av_icon_string($format) . "></span><span class='slider-fallback-image'>{{thumbnail}}</span>";
$thumb_class = "fake-thumbnail";
}
$permalink = '<div class="read-more-link"><a href="' . get_permalink($the_id) . '" class="more-link">' . __('Read more', 'avia_framework') . '<span class="more-link-arrow"> →</span></a></div>';
$prepare_excerpt = !empty($entry->post_excerpt) ? $entry->post_excerpt : avia_backend_truncate($entry->post_content, apply_filters('avf_postgrid_excerpt_length', 60), apply_filters('avf_postgrid_excerpt_delimiter', " "), "…", true, '');
if ($format == 'link') {
$current_post = array();
$current_post['content'] = $entry->post_content;
$current_post['title'] = $entry->post_title;
if (function_exists('avia_link_content_filter')) {
$current_post = avia_link_content_filter($current_post);
}
$link = $current_post['url'];
}
switch ($contents) {
case "excerpt":
$excerpt = $prepare_excerpt;
$title = $entry->post_title;
break;
case "excerpt_read_more":
$excerpt = $prepare_excerpt;
$excerpt .= $permalink;
$title = $entry->post_title;
break;
case "title":
$excerpt = '';
$title = $entry->post_title;
break;
case "title_read_more":
$excerpt = $permalink;
$title = $entry->post_title;
break;
//.........这里部分代码省略.........
示例5: the_post
the_post();
$slidecount++;
if ($count == 1) {
$output .= "<div class='single_slide single_slide_nr_{$slidecount}'>";
}
$image = get_the_post_thumbnail(get_the_ID(), 'portfolio_small');
if (empty($image)) {
$image = "<span class='related_posts_default_image'></span>";
}
$output .= "<div class='relThumb relThumb flex_column {$count} {$first} {$rel_class}'>\n";
$output .= "<a href='" . get_permalink() . "' class='relThumWrap noLightbox'>\n";
$output .= "<span class='related_image_wrap'>";
$output .= $image;
$output .= "</span>\n";
$output .= "<span class='relThumbTitle'>\n";
$output .= "<strong class='relThumbHeading'>" . avia_backend_truncate(get_the_title(), 50) . "</strong>\n";
$output .= "</span>\n</a>";
$output .= "</div><!-- end .relThumb -->\n";
$count++;
$first = "";
if ($count == $columns + 1) {
$first = "first";
$output .= "</div>";
$count = 1;
}
}
if ($count != 1) {
$output .= "</div>";
}
$output .= "</div></div>";
echo '<div data-fake-id="#tab-id-2" class="tab">' . __('Portfolio', 'avia_framework') . '</div>' . "\n";
示例6: send
/**
* Send the form
*
* The send method tries to send the form. It builds the necessary email and submits it via wp_mail
*/
function send()
{
$new_post = array();
foreach ($_POST as $key => $post) {
$new_post[str_replace('avia_', '', $key)] = $post;
}
$mymail = empty($this->form_params['myemail']) ? $new_post['myemail'] : $this->form_params['myemail'];
$myblogname = empty($this->form_params['myblogname']) ? $new_post['myblogname'] : $this->form_params['myblogname'];
if (empty($new_post['subject_' . $this->formID]) && !empty($this->form_params['subject'])) {
$new_post['subject_' . $this->formID] = $this->form_params['subject'];
}
$subject = empty($new_post['subject_' . $this->formID]) ? __("New Message", 'avia_framework') . " (" . __('sent by contact form at', 'avia_framework') . " " . $myblogname . ")" : $new_post['subject_' . $this->formID];
$default_from = parse_url(home_url());
//hook to stop execution here and do something different with the data
$proceed = apply_filters('avf_form_send', true, $new_post, $this->form_params);
if (!$proceed) {
return true;
}
//set the email adress
$from = "no-reply@wp-message.com";
$usermail = false;
if (!empty($default_from['host'])) {
$from = "no-reply@" . $default_from['host'];
}
if (!empty($this->autoresponder[0])) {
$from = $_POST[$this->autoresponder[0]];
$usermail = true;
} else {
$email_variations = array('e-mail', 'email', 'mail');
foreach ($email_variations as $key) {
foreach ($new_post as $current_key => $current_post) {
if (strpos($current_key, $key) !== false) {
$from = $new_post[$current_key];
$usermail = true;
break;
}
}
if ($usermail == true) {
break;
}
}
}
$to = urldecode($mymail);
$delimiter = ",";
if (strpos($to, ',') === false && strpos($to, ' ') !== false) {
$delimiter = " ";
}
$to = array_filter(array_map('trim', explode($delimiter, $to)));
$to = apply_filters("avf_form_sendto", $to, $new_post, $this->form_params);
$from = urldecode($from);
$from = apply_filters("avf_form_from", $from, $new_post, $this->form_params);
$subject = urldecode($subject);
$subject = apply_filters("avf_form_subject", $subject, $new_post, $this->form_params);
$message = "";
$iterations = 0;
foreach ($this->form_elements as $key => $element) {
$key = avia_backend_safe_string($key, '_', true);
if (empty($key)) {
$iterations++;
$key = $iterations;
}
// substract 5 characters from the string length because we removed the avia_ prefix with 5 characters at the beginning of the send() function
$key = avia_backend_truncate($key, $this->length - 5, "_", "", false, '', false);
$key .= $this->id_sufix;
if (!empty($new_post[$key])) {
if ($element['type'] != 'hidden' && $element['type'] != 'decoy') {
if ($element['type'] == 'textarea') {
$message .= " <br/>";
}
$field_value = apply_filters("avf_form_mail_field_values", nl2br(urldecode($new_post[$key])), $new_post, $this->form_elements, $this->form_params);
$message .= $element['label'] . ": " . $field_value . " <br/>";
if ($element['type'] == 'textarea') {
$message .= " <br/>";
}
}
}
}
$use_wpmail = apply_filters("avf_form_use_wpmail", true, $new_post, $this->form_params);
//$header = 'MIME-Version: 1.0' . "\r\n";
$header = 'Content-type: text/html; charset=utf-8' . "\r\n";
$header = apply_filters("avf_form_mail_header", $header, $new_post, $this->form_params);
$copy = apply_filters("avf_form_copy", $to, $new_post, $this->form_params);
$message = stripslashes($message);
foreach ($copy as $send_to_mail) {
if ($use_wpmail) {
$header .= 'From: ' . $from . " <" . $from . "> \r\n";
wp_mail($send_to_mail, $subject, $message, $header);
} else {
$header .= 'From:' . $from . " \r\n";
mail($send_to_mail, $subject, $message, $header);
}
}
//autoresponder?
if ($usermail && !empty($this->form_params['autoresponder'])) {
//$header = 'MIME-Version: 1.0' . "\r\n";
//.........这里部分代码省略.........
示例7: render_entry
function render_entry($entry, $style)
{
$output = "";
$image = get_the_post_thumbnail($entry->ID, $this->atts['image_size'][$style]);
$link = get_permalink($entry->ID);
$titleAttr = "title='" . __('Link to:', 'avia_framework') . " " . the_title_attribute('echo=0') . "'";
$title = "<a href='{$link}' {$titleAttr}>" . get_the_title($entry->ID) . "</a>";
$titleTag = "h3";
$excerpt = "";
$time = get_the_time(get_option('date_format'), $entry->ID);
$separator = "<span class='av-magazine-text-sep text-sep-date'>/</span>";
$author = apply_filters('avf_author_name', get_the_author_meta('display_name', $entry->post_author), $entry->post_author);
$author = "<span class='av-magazine-author meta-color vcard author'><span class='fn'>" . __('by', 'avia_framework') . ' ' . $author . "</span></span>";
$markupEntry = avia_markup_helper(array('context' => 'entry', 'echo' => false, 'id' => $entry->ID, 'custom_markup' => $this->atts['custom_markup']));
$markupTitle = avia_markup_helper(array('context' => 'entry_title', 'echo' => false, 'id' => $entry->ID, 'custom_markup' => $this->atts['custom_markup']));
$markupContent = avia_markup_helper(array('context' => 'entry_content', 'echo' => false, 'id' => $entry->ID, 'custom_markup' => $this->atts['custom_markup']));
$markupTime = avia_markup_helper(array('context' => 'entry_time', 'echo' => false, 'id' => $entry->ID, 'custom_markup' => $this->atts['custom_markup']));
$format = get_post_format($entry->ID) ? get_post_format($entry->ID) : 'standard';
$type = get_post_type($entry->ID);
$icontype = $type == 'post' ? $format : $type;
$icon = "<a href='{$link}' {$titleAttr} class='iconfont av-magazine-entry-icon' " . av_icon_string($icontype) . "></a>";
$extraClass = "";
if ($style == 'small') {
if (empty($this->atts['thumbnails'])) {
$image = "";
$extraClass = "av-magazine-no-thumb";
}
} else {
$excerpt = !empty($entry->post_excerpt) ? $entry->post_excerpt : avia_backend_truncate($entry->post_content, apply_filters('avf_magazine_excerpt_length', 60), apply_filters('avf_magazine_excerpt_delimiter', " "), "…", true, '');
}
$output .= "<article class='av-magazine-entry av-magazine-entry-id-" . $entry->ID . " av-magazine-format-{$format} av-magazine-type-{$type} av-magazine-entry-" . $entry->loop . " av-magazine-entry-" . $style . " {$extraClass}' {$markupEntry}>";
if ($this->atts['thumbnails'] || $style == 'big' && $image) {
$output .= "<div class='av-magazine-thumbnail'>";
if ($image) {
$output .= "<a href='{$link}' {$titleAttr} class='av-magazine-thumbnail-link '>{$image}</a>";
}
if (!$image) {
$output .= $icon;
}
$output .= "</div>";
}
$output .= "<div class='av-magazine-content-wrap'>";
$output .= "<header class='entry-content-header'>";
$output .= "<time class='av-magazine-time updated' {$markupTime}>" . $time . "</time>";
$output .= $separator . $author;
$output .= "<{$titleTag} class='av-magazine-title entry-title' {$markupTitle}>{$title}</{$titleTag}>";
$output .= "</header>";
if ($excerpt) {
$output .= "<div class='av-magazine-content entry-content' {$markupContent}>{$excerpt}</div>";
}
$output .= "</div>";
$output .= "<footer class='entry-footer'></footer>";
$output .= "</article>";
return $output;
}
示例8: prepare_loop_from_entries
function prepare_loop_from_entries()
{
$this->loop = array();
if (empty($this->entries) || empty($this->entries->posts)) {
return;
}
$tagTax = "post_tag";
$date_format = get_option('date_format');
foreach ($this->entries->posts as $key => $entry) {
$overlay_img = $custom_url = false;
$img_size = 'masonry';
$author = apply_filters('avf_author_name', get_the_author_meta('display_name', $entry->post_author), $entry->post_author);
$this->loop[$key]['text_before'] = "";
$this->loop[$key]['text_after'] = "";
$this->loop[$key]['ID'] = $id = $entry->ID;
$this->loop[$key]['post_type'] = $entry->post_type;
$this->loop[$key]['thumb_ID'] = get_post_thumbnail_id($id);
$this->loop[$key]['the_title'] = get_the_title($id);
$this->loop[$key]['url'] = get_permalink($id);
$this->loop[$key]['date'] = "<span class='av-masonry-date meta-color updated'>" . get_the_time($date_format, $id) . "</span>";
$this->loop[$key]['author'] = "<span class='av-masonry-author meta-color vcard author'><span class='fn'>" . __('by', 'avia_framework') . ' ' . $author . "</span></span>";
$this->loop[$key]['class'] = get_post_class("av-masonry-entry isotope-item", $id);
$this->loop[$key]['content'] = $entry->post_excerpt;
$this->loop[$key]['description'] = !empty($entry->post_content) ? $entry->post_content : $entry->post_excerpt;
if (empty($this->loop[$key]['content'])) {
$this->loop[$key]['content'] = avia_backend_truncate($entry->post_content, apply_filters('avf_masonry_excerpt_length', 60), apply_filters('avf_masonry_excerpt_delimiter', " "), "…", true, '');
}
//post type specific
switch ($entry->post_type) {
case 'post':
$post_format = get_post_format($id) ? get_post_format($id) : 'standard';
$this->loop[$key] = apply_filters('post-format-' . $post_format, $this->loop[$key]);
$this->loop[$key]['text_after'] .= $this->loop[$key]['date'];
$this->loop[$key]['text_after'] .= '<span class="av-masonry-text-sep text-sep-author">/</span>';
$this->loop[$key]['text_after'] .= $this->loop[$key]['author'];
switch ($post_format) {
case 'quote':
case 'link':
case 'image':
case 'gallery':
if (!$this->loop[$key]['thumb_ID']) {
$this->loop[$key]['text_before'] = av_icon_display($post_format);
}
break;
case 'audio':
case 'video':
if (!$this->loop[$key]['thumb_ID']) {
$this->loop[$key]['text_before'] = av_icon_display($post_format);
} else {
$this->loop[$key]['text_before'] = av_icon_display($post_format, 'av-masonry-media');
}
break;
}
break;
case 'portfolio':
//set portfolio breadcrumb navigation
if ($this->atts['set_breadcrumb'] && is_page()) {
$_SESSION["avia_{$entry->post_type}"] = get_the_ID();
}
//check if the user has set up a custom link
if (!post_password_required($id)) {
$custom_link = get_post_meta($id, '_portfolio_custom_link', true) != "" ? get_post_meta($id, '_portfolio_custom_link_url', true) : false;
if ($custom_link) {
$this->loop[$key]['url'] = $custom_link;
}
}
break;
case 'attachment':
$custom_url = get_post_meta($id, 'av-custom-link', true);
$this->loop[$key]['thumb_ID'] = $id;
$this->loop[$key]['content'] = $entry->post_excerpt;
if ($custom_url) {
$this->loop[$key]['url'] = $custom_url;
} else {
$this->loop[$key]['url'] = wp_get_attachment_image_src($id, apply_filters('avf_avia_builder_masonry_lightbox_img_size', 'large'));
$this->loop[$key]['url'] = reset($this->loop[$key]['url']);
}
break;
case 'product':
//check if woocommerce is enabled in the first place so we can use woocommerce functions
if (function_exists('avia_woocommerce_enabled') && avia_woocommerce_enabled()) {
$tagTax = "product_tag";
$product = get_product($id);
$overlay_img = avia_woocommerce_gallery_first_thumbnail($id, $img_size, true);
$this->loop[$key]['text_after'] .= '<span class="av-masonry-price price">' . $product->get_price_html() . "</span>";
if ($product->is_on_sale()) {
$this->loop[$key]['text_after'] .= '<span class="onsale">' . __('Sale!', 'avia_framework') . '</span>';
}
}
break;
}
//check if post is password protected
if (post_password_required($id)) {
$this->loop[$key]['content'] = "";
$this->loop[$key]['class'][] = "entry-protected";
$this->loop[$key]['thumb_ID'] = "";
$this->loop[$key]['text_before'] = av_icon_display('closed');
$this->loop[$key]['text_after'] = $this->loop[$key]['date'];
}
//set the html tags. depending on the link settings use either an a tag or a div tag
//.........这里部分代码省略.........
示例9: avia_breadcrumbs
//.........这里部分代码省略.........
if (!empty($wp_rewrite->front)) {
$path .= trailingslashit($wp_rewrite->front);
}
/* If an $author_base exists, add it to $path. */
if (!empty($wp_rewrite->author_base)) {
$path .= $wp_rewrite->author_base;
}
/* If $path exists, check for parent pages. */
if (!empty($path)) {
$trail = array_merge($trail, avia_breadcrumbs_get_parents('', $path));
}
/* Add the author's display name to the trail end. */
$trail['trail_end'] = apply_filters('avf_author_name', get_the_author_meta('display_name', get_query_var('author')), get_query_var('author'));
} elseif (is_time()) {
if (get_query_var('minute') && get_query_var('hour')) {
$trail['trail_end'] = get_the_time(__('g:i a', 'avia_framework'));
} elseif (get_query_var('minute')) {
$trail['trail_end'] = sprintf(__('Minute %1$s', 'avia_framework'), get_the_time(__('i', 'avia_framework')));
} elseif (get_query_var('hour')) {
$trail['trail_end'] = get_the_time(__('g a', 'avia_framework'));
}
} elseif (is_date()) {
/* If $front has been set, check for parent pages. */
if ($wp_rewrite->front) {
$trail = array_merge($trail, avia_breadcrumbs_get_parents('', $wp_rewrite->front));
}
if (is_day()) {
$trail[] = '<a href="' . get_year_link(get_the_time('Y')) . '" title="' . get_the_time(esc_attr__('Y', 'avia_framework')) . '">' . get_the_time(__('Y', 'avia_framework')) . '</a>';
$trail[] = '<a href="' . get_month_link(get_the_time('Y'), get_the_time('m')) . '" title="' . get_the_time(esc_attr__('F', 'avia_framework')) . '">' . get_the_time(__('F', 'avia_framework')) . '</a>';
$trail['trail_end'] = get_the_time(__('j', 'avia_framework'));
} elseif (get_query_var('w')) {
$trail[] = '<a href="' . get_year_link(get_the_time('Y')) . '" title="' . get_the_time(esc_attr__('Y', 'avia_framework')) . '">' . get_the_time(__('Y', 'avia_framework')) . '</a>';
$trail['trail_end'] = sprintf(__('Week %1$s', 'avia_framework'), get_the_time(esc_attr__('W', 'avia_framework')));
} elseif (is_month()) {
$trail[] = '<a href="' . get_year_link(get_the_time('Y')) . '" title="' . get_the_time(esc_attr__('Y', 'avia_framework')) . '">' . get_the_time(__('Y', 'avia_framework')) . '</a>';
$trail['trail_end'] = get_the_time(__('F', 'avia_framework'));
} elseif (is_year()) {
$trail['trail_end'] = get_the_time(__('Y', 'avia_framework'));
}
}
} elseif (is_search()) {
$trail['trail_end'] = sprintf(__('Search results for "%1$s"', 'avia_framework'), esc_attr(get_search_query()));
} elseif (is_404()) {
$trail['trail_end'] = __('404 Not Found', 'avia_framework');
}
/* Allow child themes/plugins to filter the trail array. */
$trail = apply_filters('avia_breadcrumbs_trail', $trail, $args);
/* Connect the breadcrumb trail if there are items in the trail. */
if (is_array($trail)) {
$el_tag = "span";
$vocabulary = "";
//google rich snippets
if ($richsnippet === true) {
$vocabulary = 'xmlns:v="http://rdf.data-vocabulary.org/#"';
}
/* Open the breadcrumb trail containers. */
$breadcrumb = '<div class="breadcrumb breadcrumbs avia-breadcrumbs"><div class="breadcrumb-trail" ' . $vocabulary . '>';
/* If $before was set, wrap it in a container. */
if (!empty($before)) {
$breadcrumb .= '<' . $el_tag . ' class="trail-before">' . $before . '</' . $el_tag . '> ';
}
/* Wrap the $trail['trail_end'] value in a container. */
if (!empty($trail['trail_end'])) {
if (!is_search()) {
$trail['trail_end'] = avia_backend_truncate($trail['trail_end'], $truncate, " ", $pad = "...", false, '<strong><em><span>', true);
}
$trail['trail_end'] = '<' . $el_tag . ' class="trail-end">' . $trail['trail_end'] . '</' . $el_tag . '>';
}
if ($richsnippet === true) {
foreach ($trail as $key => &$link) {
if ("trail_end" == $key) {
continue;
}
$link = preg_replace('!rel=".+?"|rel=\'.+?\'|!', "", $link);
$link = str_replace('<a ', '<a rel="v:url" property="v:title" ', $link);
$link = '<span typeof="v:Breadcrumb">' . $link . '</span>';
}
}
/* Format the separator. */
if (!empty($separator)) {
$separator = '<span class="sep">' . $separator . '</span>';
}
/* Join the individual trail items into a single string. */
$breadcrumb .= join(" {$separator} ", $trail);
/* If $after was set, wrap it in a container. */
if (!empty($after)) {
$breadcrumb .= ' <span class="trail-after">' . $after . '</span>';
}
/* Close the breadcrumb trail containers. */
$breadcrumb .= '</div></div>';
}
/* Allow developers to filter the breadcrumb trail HTML. */
$breadcrumb = apply_filters('avia_breadcrumbs', $breadcrumb);
/* Output the breadcrumb. */
if ($echo) {
echo $breadcrumb;
} else {
return $breadcrumb;
}
}
示例10: avia_post_nav
function avia_post_nav($same_category = false)
{
if (!is_singular() || is_post_type_hierarchical(get_post_type())) {
return;
}
//if(get_post_type() === 'portfolio') return;
global $avia_config;
$same_category = apply_filters('avia_post_nav_categories', $same_category);
$entries['prev'] = get_previous_post($same_category);
$entries['next'] = get_next_post($same_category);
$output = "";
foreach ($entries as $key => $entry) {
if (empty($entry)) {
continue;
}
$tc1 = $tc2 = "";
$link = get_permalink($entry->ID);
$image = get_the_post_thumbnail($entry->ID, 'thumbnail');
$class = $image ? "with-image" : "without-image";
$output .= "<a class='avia-post-nav avia-post-{$key} {$class}' href='{$link}' >";
$output .= " <span class='label iconfont'>" . $avia_config['font_icons'][$key] . "</span>";
$output .= " <span class='entry-info-wrap'>";
$output .= " <span class='entry-info'>";
$tc1 = " <span class='entry-title'>" . avia_backend_truncate(get_the_title($entry->ID), 75, " ") . "</span>";
if ($image) {
$tc2 = " <span class='entry-image'>{$image}</span>";
}
$output .= $key == 'prev' ? $tc1 . $tc2 : $tc2 . $tc1;
$output .= " </span>";
$output .= " </span>";
$output .= "</a>";
}
return $output;
//add this line for fake. never gets executed but makes the theme pass Theme check
if (1 == 2) {
paginate_links();
posts_nav_link();
next_posts_link();
previous_posts_link();
}
}
示例11: get_slides
function get_slides()
{
if ($this->config['slide_type'] == "image-based") {
$this->get_image_based_slides();
} else {
$this->extract_terms();
$this->query_entries();
foreach ($this->slides as $key => $slide) {
$this->slides[$key]->av_attachment = wp_get_attachment_image(get_post_thumbnail_id($slide->ID), $this->config['size'], false, array('class' => 'aviaccordion-image'));
$this->slides[$key]->av_permalink = get_permalink($slide->ID);
$this->slides[$key]->av_target = "";
$this->slides[$key]->post_excerpt = !empty($slide->post_excerpt) ? $slide->post_excerpt : avia_backend_truncate($slide->post_content, apply_filters('avf_aviaccordion_excerpt_length', 120), apply_filters('avf_aviaccordion_excerpt_delimiter', " "), "…", true, '');
}
}
}
示例12: avia_get_comment_list
function avia_get_comment_list($avia_new_query)
{
global $avia_config;
$comments = get_comments($avia_new_query);
if (!empty($comments)) {
echo '<ul class="news-wrap">';
foreach ($comments as $comment) {
echo '<li class="news-content">';
echo "<a class='news-link' title='" . get_the_title($comment->comment_post_ID) . "' href='" . get_comment_link($comment) . "'>";
echo "<span class='news-thumb'>";
echo get_avatar($comment, '48');
echo "</span>";
echo "<strong class='news-headline'>" . avia_backend_truncate($comment->comment_content, 55, " ");
echo "<span class='news-time'>" . get_the_time($time_format, $comment->comment_post_ID) . " by " . $comment->comment_author . "</span>";
echo "</strong>";
echo "</a>";
echo '</li>';
}
echo "</ul>";
wp_reset_postdata();
}
}