Exemple #1
0
 function wallow_post_details($args = '')
 {
     $defaults = array('id' => 0, 'fields' => array('featured', 'author', 'categories', 'tags', 'date', 'comments'), 'featured_label' => '', 'author_label' => '', 'categories_label' => __('Categories', 'wallow') . ': ', 'tags_label' => __('Tags', 'wallow') . ': ', 'date_label' => __('Published', 'wallow') . ': ', 'comments_label' => __('Comments', 'wallow') . ': ', 'featured_class' => 'thumb', 'author_class' => 'author', 'categories_class' => 'cats', 'tags_class' => 'tags', 'date_class' => 'date', 'comments_class' => 'comments', 'avatar_size' => 48, 'taxomony_separator' => apply_filters('wallow_filter_taxomony_separator', ', '), 'class' => '', 'format' => 'ul', 'echo' => 1);
     $args = wp_parse_args($args, $defaults);
     foreach (array('author_label', 'categories_label', 'tags_label', 'date_label', 'comments_label') as $label) {
         $args[$label] = $args[$label] ? '<span class="label">' . $args[$label] . '</span>' : $args[$label];
     }
     $args['id'] = intval($args['id']);
     $post = get_post($args['id']);
     $args['class'] = $args['class'] ? ' ' . esc_attr($args['class']) : '';
     $details = array();
     foreach ((array) $args['fields'] as $field) {
         if ($field == 'featured') {
             $details[$field] = has_post_thumbnail($post->ID) ? get_the_post_thumbnail($post->ID, 'thumbnail') : apply_filters('wallow_filter_details_featured', '');
         } elseif ($field == 'author') {
             if ($args['author_label']) {
                 $details[$field] = get_the_author_meta('nickname', $post->post_author);
             } else {
                 $details[$field] = wallow_author_badge($post->post_author, $args['avatar_size']);
             }
         } elseif ($field == 'categories') {
             $details[$field] = get_the_category_list($args['taxomony_separator'], '', $post->ID);
         } elseif ($field == 'tags') {
             $details[$field] = has_tag('', $post->ID) ? get_the_tag_list('', $args['taxomony_separator'], '', $post->ID) : __('No Tags', 'wallow');
         } elseif ($field == 'date') {
             $details[$field] = '<a href="' . esc_url(get_day_link(get_the_time('Y', $post->ID), get_the_time('m', $post->ID), get_the_time('d', $post->ID))) . '">' . get_the_time(get_option('date_format'), $post->ID) . '</a>';
         } elseif ($field == 'comments') {
             $details[$field] = wallow_get_comments_link();
         }
     }
     if ($args['format'] == 'array') {
         return $details;
     }
     if ($args['format'] == 'div') {
         $tag = array('out' => 'div', 'in' => 'div');
     } else {
         $tag = array('out' => 'ul', 'in' => 'li');
     }
     $output = '<' . $tag['out'] . ' class="post-details' . $args['class'] . '">';
     foreach ($details as $key => $value) {
         $text = strpos($args[$key . '_label'], '%s') === false ? $args[$key . '_label'] . $value : sprintf($args[$key . '_label'], $value);
         $output .= '<' . $tag['in'] . ' class="post-details-' . $args[$key . '_class'] . '">' . $text . '</' . $tag['in'] . '>';
     }
     $output .= '</' . $tag['out'] . '>';
     if (!$args['echo']) {
         return $output;
     }
     echo $output;
 }
Exemple #2
0
function wallow_search_reminder()
{
    global $post;
    $text = wallow_get_search_reminder(array('archive_label' => sprintf(__('%s archive', 'wallow'), get_bloginfo('name')) . '<br />%s: '));
    if ($text) {
        ?>
	<div class="search-reminder">
		<p><?php 
        echo $text;
        ?>
</p>
	</div>
<?php 
    }
    if (wallow_get_opt('wallow_cat_description') && is_category() && category_description()) {
        ?>
	<div class="search-reminder">
		<p><?php 
        echo category_description();
        ?>
</p>
	</div>
<?php 
    }
    if (is_author()) {
        echo wallow_author_badge($post->post_author, 48);
    }
}
Exemple #3
0
 function post_details($args = '')
 {
     global $post;
     $defaults = array('author' => 1, 'date' => 1, 'tags' => 1, 'categories' => 1, 'avatar_size' => 48, 'featured' => 0, 'echo' => 1);
     $args = wp_parse_args($args, $defaults);
     $tax_separator = apply_filters('wallow_filter_taxomony_separator', ', ');
     $output = '';
     if ($args['featured'] && has_post_thumbnail($post->ID)) {
         $output .= '<div class="post-details-thumb">' . get_the_post_thumbnail($post->ID, 'thumbnail') . '</div>';
     }
     if ($args['author']) {
         $output .= wallow_author_badge($post->post_author, $args['avatar_size']);
     }
     $output .= '<ul class="post-details">';
     if ($args['categories']) {
         $output .= '<li class="post-details-cats"><i class="icon-folder-close"></i> <span>' . __('Categories', 'wallow') . ': </span>' . get_the_category_list($tax_separator) . '</li>';
     }
     if ($args['tags']) {
         $tags = get_the_tags() ? get_the_tag_list('</span>', $tax_separator, '') : __('No Tags', 'wallow') . '</span>';
     }
     $output .= '<li class="post-details-tags"><i class="icon-tags"></i> <span>' . __('Tags', 'wallow') . ': ' . $tags . '</li>';
     if ($args['date']) {
         $output .= '<li class="post-details-date"><i class="icon-time"></i> <span>' . __('Published', 'wallow') . ': </span><a href="' . esc_url(get_day_link(get_the_time('Y'), get_the_time('m'), get_the_time('d'))) . '">' . get_the_time(get_option('date_format')) . '</a></li>';
     }
     $output .= '</ul>';
     if (!$args['echo']) {
         return $output;
     }
     echo $output;
 }