/**
  * Prints HTML with meta information for the current post-date/time and author.
  */
 function square_posted_on()
 {
     $time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>';
     if (get_the_time('U') !== get_the_modified_time('U')) {
         $time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time><time class="updated" datetime="%3$s">%4$s</time>';
     }
     $time_string = sprintf($time_string, esc_attr(get_the_date('c')), esc_html(get_the_date()), esc_attr(get_the_modified_date('c')), esc_html(get_the_modified_date()));
     $posted_on = sprintf(esc_html_x('%s', 'post date', 'square'), '<a href="' . esc_url(get_permalink()) . '" rel="bookmark">' . $time_string . '</a>');
     $byline = sprintf(esc_html_x('by %s', 'post author', 'square'), '<span class="author vcard"><a class="url fn n" href="' . esc_url(get_author_posts_url(get_the_author_meta('ID'))) . '">' . esc_html(get_the_author()) . '</a></span>');
     $comment_count = get_comments_number();
     // get_comments_number returns only a numeric value
     if (comments_open()) {
         if ($comment_count == 0) {
             $comments = __('No Comments', 'square');
         } elseif ($comment_count > 1) {
             $comments = $comment_count . __(' Comments', 'square');
         } else {
             $comments = __('1 Comment', 'square');
         }
         $comment_link = '<a href="' . get_comments_link() . '">' . $comments . '</a>';
     } else {
         $comment_link = __(' Comment Closed', 'square');
     }
     echo '<span class="posted-on"><i class="fa fa-clock-o"></i>' . $posted_on . '</span><span class="byline"> ' . $byline . '</span><span class="comment-count"><i class="fa fa-comments-o"></i>' . $comment_link . "</span>";
     // WPCS: XSS OK.
 }
Example #2
0
function get_index_headline()
{
    if (is_home()) {
        $index_headline = 'Blog Index';
    } else {
        if (is_category()) {
            $category = single_term_title("", false);
            $index_headline = 'Archives for the "' . $category . '" Category';
        } elseif (is_tag()) {
            $tag = single_term_title("", false);
            $index_headline = 'Archives for the "' . $tag . '" Category';
        } elseif (is_day()) {
            $index_headline = 'Archive for ' . get_the_time('F jS, Y');
        } elseif (is_month()) {
            $index_headline = 'Archive for ' . get_the_time('F Y');
        } elseif (is_year()) {
            $index_headline = 'Archive for ' . get_the_time('Y');
        } elseif (is_author()) {
            $index_headline = 'Author Archive';
        } else {
            $index_headline = 'Blog Archives';
        }
    }
    return $index_headline;
}
 function thirdrail_entry_meta()
 {
     echo '<div class="entry-meta">';
     echo '<p class="byline"><a href="' . get_author_posts_url(get_the_author_meta('ID')) . '" rel="author" class="author">' . get_the_author() . '</a>' . cats() . '</p>';
     echo '<time class="updated date" datetime="' . get_the_time('c') . '">' . sprintf(__('%s', 'thirdrail'), get_the_date()) . '</time>';
     echo '</div>';
 }
Example #4
0
 /**
  * Latest blog posts
  *
  * @param int    $limit post display limit
  *
  * @param string $thumbnail_size
  *
  * @return array
  */
 public static function getRecent($limit = 10, $thumbnail_size = 'thumbnail')
 {
     $args = array('numberposts' => $limit, 'offset' => 0, 'category' => 0, 'orderby' => 'post_date', 'order' => 'DESC', 'include' => '', 'exclude' => '', 'meta_key' => '', 'meta_value' => '', 'post_type' => 'post', 'post_status' => 'draft, publish, future, pending', 'suppress_filters' => true);
     $array_out = array();
     $recent_posts = \get_posts(\wp_parse_args($args));
     /*$like_bool    = Option::get_theme_option( 'blog_list_like' );
       if ( $like_bool === '1' ) {
           $PostLike = \SilverWp\Ajax\PostLike::getInstance();
       }*/
     foreach ($recent_posts as $key => $recent) {
         \setup_postdata($recent);
         $post_id = $recent->ID;
         //$array_out[ $key ] = $recent;
         $array_out[$key]['ID'] = $post_id;
         $array_out[$key]['post_title'] = \get_the_title($post_id);
         $array_out[$key]['url'] = \get_the_permalink($post_id);
         $array_out[$key]['post_author'] = \get_the_author();
         $array_out[$key]['post_date'] = \get_the_date('', $post_id);
         $array_out[$key]['post_date_utc'] = \get_the_time('c', $post_id);
         //$array_out[ $key ]['post_like'] = ($like_bool === '1') ? $PostLike->getPostLikeCount($post_id) : '';
         $array_out[$key]['post_comment_count'] = $recent->comment_count;
         if (strpos($recent->post_content, '<!--more-->') || empty($recent->post_excerpt)) {
             $array_out[$key]['post_excerpt'] = \get_the_excerpt();
         } else {
             $array_out[$key]['post_excerpt'] = $recent->post_excerpt;
         }
         $array_out[$key]['image_html'] = \get_the_post_thumbnail($post_id, $thumbnail_size);
         // Thumbnail
         $array_out[$key]['categories'] = self::getTaxonomy($post_id);
     }
     \wp_reset_postdata();
     return $array_out;
 }
function genesis_post_time_shortcode($atts)
{
    $defaults = array('format' => get_option('time_format'), 'before' => '', 'after' => '', 'label' => '');
    $atts = shortcode_atts($defaults, $atts);
    $output = sprintf('<span class="time published" title="%5$s">%1$s%3$s%4$s%2$s</span> ', $atts['before'], $atts['after'], $atts['label'], get_the_time($atts['format']), get_the_time('Y-m-d\\TH:i:sO'));
    return apply_filters('genesis_post_time_shortcode', $output, $atts);
}
Example #6
0
/**
 * Displays meta information for a post
 * @return void
 */
function appletree_post_meta()
{
    if (get_post_type() == 'post') {
        echo sprintf(__('Posted %s in %s%s by %s. ', 'appletreesg.com'), get_the_time(get_option('date_format')), get_the_category_list(', '), get_the_tag_list(__(', <b>Tags</b>: ', 'appletreesg.com'), ', '), get_the_author_link());
    }
    edit_post_link(__(' (edit)', 'appletreesg.com'), '<span class="edit-link">', '</span>');
}
Example #7
0
 function end_el(&$output, $item, $depth = 0, $args = array())
 {
     if ($depth == 0 && $item->object == 'category') {
         $output .= "<div class='subcat'>";
         for ($i = 0; $i < count($item->children); $i++) {
             $child = $item->children[$i];
             $output .= "<div class='" . ($i === 0 ? 'active' : '') . "' id='mn-latest-" . $child->ID . "'>";
             //$output .="<h5>".$child->title."</h5>";
             $output .= "<ul id='mn-latest-" . $child->ID . "'>";
             if ($child->object == 'category') {
                 $r = new WP_Query(apply_filters('widget_posts_args', array('posts_per_page' => 5, 'no_found_rows' => true, 'post_status' => 'publish', 'cat' => $child->object_id)));
                 if ($r->have_posts()) {
                     while ($r->have_posts()) {
                         $r->the_post();
                         $output .= "<li ";
                         if (has_post_thumbnail()) {
                             $output .= "class='has-thumbnail' ";
                         }
                         $output .= "><div class='subcat-thumbnail'><a href='" . get_permalink() . "' title='" . get_the_title() . "'>" . get_the_post_thumbnail(get_the_ID(), array(40, 40)) . "</a></div><div class='subcat-title'><a href='" . get_permalink() . "' title='" . get_the_title() . "'> " . get_the_title() . "</a><span> - " . dw_human_time_diff(get_the_time('U'), current_time('timestamp')) . "</span></div></li>";
                     }
                     // Reset the global $the_post as this query will have stomped on it
                     wp_reset_postdata();
                 }
             }
             $output .= "</ul>";
             $output .= "<a href='" . $child->url . "' title='" . $child->attr_title . "'>View all</a>";
             $output .= "</div>";
         }
         $output .= "</div> \n</div>\n";
     } else {
     }
     $output .= "</li>\n";
 }
Example #8
0
 /**
  * Get things started
  *
  * @access public
  * @since 2.7
  * @return void/
  */
 public function __construct($sub_id)
 {
     global $ninja_forms_fields;
     // Bail if the sub doesn't exist.
     $sub = get_post($sub_id);
     if (!is_object($sub)) {
         return false;
     }
     // Set our sub id
     $this->sub_id = $sub_id;
     // Populate our fields
     $this->fields = array();
     $this->retrieve_fields();
     // Setup our form id var
     $this->form_id = $this->get_meta('_form_id');
     // Setup our action var
     $this->action = $this->get_meta('_action');
     // Setup our sequential id
     $this->seq_num = $this->get_meta('_seq_num');
     // Setup our user_id var
     $this->user_id = $sub->post_author;
     // Setup our date submitted var
     $this->date_submitted = get_the_time('Y-m-d G:i:s', $sub_id);
     // Setup our date modified var
     $this->date_modified = get_post_modified_time('Y-m-d G:i:s', false, $sub_id);
 }
Example #9
0
    function widget($args, $instance)
    {
        extract($args, EXTR_SKIP);
        $instance = wp_parse_args($instance, array('title' => __('Latest Questions', 'dwqa'), 'number' => 5));
        echo $before_widget;
        echo $before_title;
        echo $instance['title'];
        echo $after_title;
        $args = array('posts_per_page' => $instance['number'], 'order' => 'DESC', 'orderby' => 'post_date', 'post_type' => 'dwqa-question', 'suppress_filters' => false);
        $questions = new WP_Query($args);
        if ($questions->have_posts()) {
            echo '<div class="dwqa-popular-questions">';
            echo '<ul>';
            while ($questions->have_posts()) {
                $questions->the_post();
                echo '
				<li><a href="' . get_permalink() . '" class="question-title">' . get_the_title() . '</a> ' . __('asked by', 'dwqa') . ' ' . (dwqa_is_anonymous(get_the_ID()) ? __('Anonymous', 'dwqa') : get_the_author_link()) . ', ' . human_time_diff(get_the_time('U'), current_time('timestamp')) . ' ago';
                '</li>';
            }
            echo '</ul>';
            echo '</div>';
        }
        wp_reset_query();
        wp_reset_postdata();
        echo $after_widget;
    }
function twentyten_posted_on()
{
    $meta = array();
    $meta['author'] = sprintf(__('%1$s <span class="meta-sep">by</span> %2$s', 'wordcampbase'), sprintf('<a href="%1$s" title="%2$s" rel="bookmark"><span class="entry-date">%3$s</span></a>', get_permalink(), esc_attr(get_the_time()), get_the_date()), sprintf('<span class="author vcard"><a class="url fn n" href="%1$s" title="%2$s">%3$s</a></span>', get_author_posts_url(get_the_author_meta('ID')), sprintf(esc_attr__('View all posts by %s', 'wordcampbase'), get_the_author()), get_the_author()));
    $meta['sep'] = ' <span class="meta-sep meta-sep-bull">&bull;</span> ';
    $meta['comments'] = array('before' => '<span class="comments-link">', 'after' => '</span>', 'zero' => __('Leave a comment', 'wordcampbase'), 'one' => __('1 Comment', 'wordcampbase'), 'many' => __('% Comments', 'wordcampbase'));
    $meta['edit'] = array('title' => __('Edit', 'wordcampbase'), 'before' => '<span class="edit-link">', 'after' => '</span>');
    $meta['br'] = '<br />';
    // Just to have.
    $meta['order'] = array('author', 'sep', 'comments', 'edit');
    $meta = apply_filters('wcb_entry_meta', $meta);
    if (!is_array($meta) || !isset($meta['order'])) {
        return;
    }
    foreach ($meta['order'] as $type) {
        $content = $meta[$type];
        switch ($type) {
            case 'comments':
                echo $content['before'];
                comments_popup_link($content['zero'], $content['one'], $content['many']);
                echo $content['after'];
                break;
            case 'edit':
                if (isset($meta['sep'])) {
                    $content['before'] = $meta['sep'] . $content['before'];
                }
                edit_post_link($content['title'], $content['before'], $content['after']);
                break;
            default:
                echo $content;
        }
    }
}
Example #11
0
 /**
  * Prints HTML with meta information for the current post-date/time and author.
  */
 function material_design_par_amauri_posted_on()
 {
     $time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>';
     if (get_the_time('U') !== get_the_modified_time('U')) {
         $time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time><time class="updated" datetime="%3$s">%4$s</time>';
     }
     $time_string = sprintf($time_string, esc_attr(get_the_date('c')), esc_html(get_the_date()), esc_attr(get_the_modified_date('c')), esc_html(get_the_modified_date()));
     $posted_on = sprintf(esc_html__('Posted on %s', 'material-design-par-amauri'), '<a href="' . esc_url(get_permalink()) . '" rel="bookmark">' . $time_string . '</a>');
     $byline = sprintf(esc_html__('by %s', 'material-design-par-amauri'), '<span class="author vcard"><a class="url fn n" href="' . esc_url(get_author_posts_url(get_the_author_meta('ID'))) . '">' . esc_html(get_the_author()) . '</a></span>');
     if (is_singular()) {
         echo '<img width="36" height="36" src="' . esc_url(get_template_directory_uri() . '/image/icon/_' . get_post_format() . '.png') . '" alt="' . get_post_format() . '" /> ';
     }
     echo '<span class="posted-on">' . $posted_on . '</span><span class="byline"> ' . $byline . '</span> ';
     if ('post' == get_post_type()) {
         /* translators: used between list items, there is a space after the comma */
         $categories_list = get_the_category_list(esc_html__(', ', 'material-design-par-amauri'));
         if ($categories_list && material_design_par_amauri_categorized_blog()) {
             printf('<span class="cat-links">' . esc_html__('in %1$s', 'material-design-par-amauri') . '</span>', $categories_list);
             // WPCS: XSS OK.
         }
         /* translators: used between list items, there is a space after the comma */
         $tags_list = get_the_tag_list('', esc_html__(', ', 'material-design-par-amauri'));
         if ($tags_list) {
             printf('<span class="tags-links">' . esc_html__(', tagged: %1$s', 'material-design-par-amauri') . '</span>', $tags_list);
             // WPCS: XSS OK.
         }
     }
 }
 public function __construct($post = null)
 {
     if (!empty($post) && ($post = get_post($post))) {
         $this->id = $post->ID;
         $this->date = get_the_time(__('Y/m/d g:i:s A', 'flamingo'), $this->id);
         $this->subject = get_post_meta($post->ID, '_subject', true);
         $this->from = get_post_meta($post->ID, '_from', true);
         $this->from_name = get_post_meta($post->ID, '_from_name', true);
         $this->from_email = get_post_meta($post->ID, '_from_email', true);
         $this->fields = get_post_meta($post->ID, '_fields', true);
         foreach ($this->fields as $key => $value) {
             $meta_key = sanitize_key('_field_' . $key);
             if (metadata_exists('post', $post->ID, $meta_key)) {
                 $value = get_post_meta($post->ID, $meta_key, true);
                 $this->fields[$key] = $value;
             }
         }
         $this->meta = get_post_meta($post->ID, '_meta', true);
         $this->akismet = get_post_meta($post->ID, '_akismet', true);
         $terms = wp_get_object_terms($this->id, self::channel_taxonomy);
         if (!empty($terms) && !is_wp_error($terms)) {
             $this->channel = $terms[0]->slug;
         }
         if (self::spam_status == get_post_status($post)) {
             $this->spam = true;
         } else {
             $this->spam = !empty($this->akismet['spam']);
         }
     }
 }
Example #13
0
/**
 * @todo
 * Function adapted from http://graveyard.maniacalrage.net/etc/relative/.
 * @since 1.6
 */
function ar2_posted_on($echo = 1)
{
    $result = '';
    if (!ar2_get_theme_option('relative_dates')) {
        $result = sprintf(__('%s', 'ar2'), get_the_time(get_option('date_format')));
    } else {
        $diff = current_time('timestamp') - get_the_time('U');
        $months = floor($diff / 2592000);
        $diff -= $months * 2419200;
        $weeks = floor($diff / 604800);
        $diff -= $weeks * 604800;
        $days = floor($diff / 86400);
        $diff -= $days * 86400;
        $hours = floor($diff / 3600);
        $diff -= $hours * 3600;
        $minutes = floor($diff / 60);
        $diff -= $minutes * 60;
        if ($months > 0 || $months < 0) {
            // over a month old, just show date
            $result = sprintf(__('on %s', 'ar2'), get_the_time(get_option('date_format')));
        } else {
            if ($weeks > 0) {
                // weeks
                if ($weeks > 1) {
                    $result = sprintf(__('%s weeks ago', 'ar2'), number_format_i18n($weeks));
                } else {
                    $result = __('1 week ago', 'ar2');
                }
            } elseif ($days > 0) {
                // days
                if ($days > 1) {
                    $result = sprintf(__('%s days ago', 'ar2'), number_format_i18n($days));
                } else {
                    $result = __('1 day ago', 'ar2');
                }
            } elseif ($hours > 0) {
                // hours
                if ($hours > 1) {
                    $result = sprintf(__('%s hours ago', 'ar2'), number_format_i18n($hours));
                } else {
                    $result = __('1 hour ago', 'ar2');
                }
            } elseif ($minutes > 0) {
                // minutes
                if ($minutes > 1) {
                    $result = sprintf(__('%s minutes ago', 'ar2'), number_format_i18n($minutes));
                } else {
                    $result = __('1 minute ago', 'ar2');
                }
            } else {
                // seconds
                $result = __('less than a minute ago', 'ar2');
            }
        }
    }
    if ($echo) {
        echo $result;
    }
    return $result;
}
Example #14
0
/**
 * Echo post meta date shortcode.
 *
 * @since 1.0.0
 */
function beans_post_meta_date_shortcode()
{
    echo beans_output('beans_post_meta_date_prefix', __('Posted on ', 'beans'));
    echo beans_open_markup('beans_post_meta_date', 'time', array('datetime' => get_the_time('c')));
    echo beans_output('beans_post_meta_date_text', get_the_time(get_option('date_format')));
    echo beans_close_markup('beans_post_meta_date', 'time');
}
/**
 * This is a duplicate of the above. Probably delete others
 */
function kanec_entry_meta()
{
    // Time
    $time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>';
    if (get_the_time('U') !== get_the_modified_time('U')) {
        $time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time><time class="updated" datetime="%3$s">%4$s</time>';
    }
    $time_string = sprintf($time_string, esc_attr(get_the_date('c')), esc_html(get_the_date()), esc_attr(get_the_modified_date('c')), esc_html(get_the_modified_date()));
    echo '<div class="posted-on"><i class="icon icon-calendar-o"></i><a href="' . esc_url(get_permalink()) . '" rel="bookmark">' . $time_string . '</a></div>';
    // Author
    echo '<div class="byline"><i class="icon icon-user"></i><span class="author vcard"><a class="url fn n" href="' . esc_url(get_author_posts_url(get_the_author_meta('ID'))) . '">' . esc_html(get_the_author()) . '</a></span></div>';
    // Categories & Tags
    // Hide category and tag text for pages.
    if ('post' === get_post_type()) {
        /* translators: used between list items, there is a space after the comma */
        $categories_list = get_the_category_list(esc_html__(', ', 'kanec'));
        if ($categories_list && kanec_categorized_blog()) {
            echo '<div class="cat-links"><i class="icon icon-folder-open"></i>' . $categories_list . '</div>';
        }
        /* translators: used between list items, there is a space after the comma */
        $tags_list = get_the_tag_list('', esc_html__(', ', 'kanec'));
        if ($tags_list) {
            echo '<div class="tags-links"><i class="icon icon-tags"></i>' . $tags_list . '</div>';
        }
    }
    if (!is_single() && !post_password_required() && (comments_open() || get_comments_number())) {
        echo '<div class="comments-link"><i class="icon icon-comments"></i>';
        comments_popup_link(esc_html__('Leave a comment', 'kanec'), esc_html__('1 Comment', 'kanec'), esc_html__('% Comments', 'kanec'));
        echo '</div>';
    }
}
Example #16
0
/**
 * Prints HTML with meta information for the current post-date/time and author.
 */
function banana_posted_on() {
	$time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>';
	if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
		$time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time><time class="updated" datetime="%3$s">%4$s</time>';
	}

	$time_string = sprintf( $time_string,
		esc_attr( get_the_date( 'c' ) ),
		esc_html( get_the_date() ),
		esc_attr( get_the_modified_date( 'c' ) ),
		esc_html( get_the_modified_date() )
	);

	$posted_on = sprintf(
		_x( 'Posted on %s', 'post date', 'banana' ),
		'<a href="' . esc_url( get_permalink() ) . '" rel="bookmark">' . $time_string . '</a>'
	);

	$byline = sprintf(
		_x( 'by %s', 'post author', 'banana' ),
		'<span class="author vcard"><a class="url fn n" href="' . esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ) . '">' . esc_html( get_the_author() ) . '</a></span>'
	);

	echo '<span class="posted-on">' . $posted_on . '</span><span class="byline"> ' . $byline . '</span>';

}
Example #17
0
 function uw_blogroll_shortcode($atts = array())
 {
     //allow pagebuilder widgets to run the shortcode, block all other posts to prevent infinite loops
     if (get_post_type() == 'post' && !is_home()) {
         return '';
     }
     $params = array_merge(array('excerpt' => 'true', 'trim' => 'false', 'image' => 'hide', 'author' => 'show', 'titletag' => 'h2', 'number' => 5), $atts);
     if (!array_key_exists('numberposts', $params)) {
         $params['numberposts'] = $params['number'];
     }
     $posts = get_posts($params);
     foreach ($posts as $post) {
         if (!stripos($post->post_content, '[blogroll')) {
             //to prevent infinite loops in pagebuilder widgets
             $postID = $post->ID;
             $link = get_permalink($postID);
             if (in_array($params['excerpt'], array('show', 'true'))) {
                 $excerpt = strlen($post->post_excerpt) > 0 ? $post->post_excerpt : apply_filters('widget_text', $post->post_content);
                 if (in_array($params['trim'], array('show', 'true'))) {
                     $excerpt = wp_trim_words($excerpt);
                 }
                 $excerpt = wpautop($excerpt);
                 //using apply_filters('the_content', $excerpt) causes an infinite loop
                 if (in_array($params['image'], array('show', 'true'))) {
                     $image = get_the_post_thumbnail($postID, 'thumbnail', array('style' => 'float:left;padding-right:10px;'));
                     $class = 'class="pull-left"';
                 }
             }
             $author = $params['author'] === 'show' ? '<p class="author-info">' . get_the_author_meta('display_name', $post->post_author) . '</p>' : '';
             $postDate = get_the_time(get_option('date_format'), $postID);
             $html .= "<li {$class}>{$image}<span><p class=\"date\">{$postDate}</p><" . $params['titletag'] . "><a href=\"{$link}\">{$post->post_title}</a></" . $params['titletag'] . ">{$author}{$excerpt}</span></li>";
         }
     }
     return "<ul class=\"shortcode-blogroll\">{$html}</ul>";
 }
Example #18
0
/**
 * Retrieve the post date.
 *
 * @since  4.0.0
 * @param  array $args Arguments.
 * @return string      Post date.
 */
function cherry_get_the_post_date($args)
{
    $post_id = get_the_ID();
    $post_type = get_post_type($post_id);
    /**
     * Filter the default arguments used to display a post date.
     *
     * @since 4.0.0
     * @param array  $args      Array of arguments.
     * @param int    $post_id   The post ID.
     * @param string $post_type The post type of the current post.
     */
    $defaults = apply_filters('cherry_get_the_post_date_defaults', array('before' => '', 'after' => '', 'format' => get_option('date_format'), 'human_time' => ''), $post_id, $post_type);
    $args = wp_parse_args($args, $defaults);
    // If $human_time is passed in, allow for '%s ago' where '%s' is the return value of human_time_diff().
    if (!empty($args['human_time'])) {
        $time = sprintf($args['human_time'], human_time_diff(get_the_time('U'), current_time('timestamp')));
    } else {
        // Else, just grab the time based on the format.
        $time = get_the_time($args['format']);
    }
    $output = '<span class="posted-on">' . $args['before'] . '<time class="entry-date published" datetime="' . get_the_time('Y-m-d\\TH:i:sP') . '">' . $time . '</time>' . $args['after'] . '</span>';
    /**
     * Filter a post date.
     *
     * @since 4.0.0
     * @param string $output Post date.
     * @param array  $args   Arguments.
     */
    return apply_filters('cherry_get_the_post_date', $output, $args);
}
Example #19
0
 function mb_entry_date_auth()
 {
     ob_start();
     the_author_posts_link();
     echo '<div class="entry-date-auth">
         <time class="updated" datetime="' . get_the_time('c') . '">' . sprintf(__('%s', 'mb'), get_the_date()) . '</time>' . __(' By ', 'responsive-brix') . ob_get_clean() . '</div>';
 }
Example #20
0
/** DistinctPress Post Date */
function distinctpress_post_date()
{
    $post_date = esc_html(get_the_date()) . " " . esc_attr(get_the_time());
    /** Output */
    $output = sprintf('<span class="entry-date" title="%1$s"><a href="%2$s" title="%3$s" rel="bookmark"><i class="el-icon-time-alt meta-icon"></i>%1$s</a></span>', $post_date, esc_url(get_permalink()), the_title_attribute('echo=0'));
    return $output;
}
Example #21
0
    function airballoon_display_postmeta()
    {
        ?>
		
		<span class="meta-date">
		<?php 
        printf('<a href="%1$s" title="%2$s" rel="bookmark"><time datetime="%3$s">%4$s</time></a>', esc_url(get_permalink()), esc_attr(get_the_time()), esc_attr(get_the_date('c')), esc_html(get_the_date()));
        ?>
		</span>
		<span class="meta-author">
		<?php 
        printf('<a href="%1$s" title="%2$s" rel="author">%3$s</a>', esc_url(get_author_posts_url(get_the_author_meta('ID'))), esc_attr(sprintf(__('View all posts by %s', 'airballoon-lite'), get_the_author())), get_the_author());
        ?>
		</span>
		
	<?php 
        if (comments_open()) {
            ?>
			<span class="meta-comments">
				<?php 
            comments_popup_link(__('Leave a comment', 'airballoon-lite'), __('One comment', 'airballoon-lite'), __('% comments', 'airballoon-lite'));
            ?>
			</span>
<?php 
        }
        edit_post_link(__('Edit Post', 'airballoon-lite'));
    }
Example #22
0
function shortcode_list_posts($atts, $content = null)
{
    extract(shortcode_atts(array('posts_per_page' => -1, 'cat' => '', 'tag' => '', 'order' => '', 'order_by' => ''), $atts));
    $args = array('post_type' => 'post', 'posts_per_page' => $posts_per_page, 'post_status' => 'publish');
    if (!empty($cat)) {
        $cat = split(',', str_replace(" ", "", $cat));
        $args['category__and'] = $cat;
    }
    if (!empty($tag)) {
        $tag = split(',', str_replace(" ", "", $tag));
        $args['tag__in'] = $tag;
    }
    if ($order) {
        $args['order'] = $order;
    }
    if ($order_by) {
        $args['orderby'] = $order_by;
    }
    $my_query = new WP_Query();
    $my_query->query($args);
    $content = '<ul class="post-list" >';
    while ($my_query->have_posts()) {
        $my_query->the_post();
        $author = get_the_author_meta('display_name');
        $author_url = get_author_posts_url(get_the_author_meta('ID'));
        $content .= '<li><a href="' . get_permalink() . '" title="' . get_the_title() . '">' . get_the_title() . '</a> <span>- by <a href="' . $author_url . '" title="' . $author . '">' . $author . '</a> on ' . get_the_time('F j, Y') . '</span></li>' . "\n";
    }
    $content .= '</ul><!-- end .post-list -->';
    //wp_reset_query();
    return remove_wpautop($content);
}
Example #23
0
 /**
  * Prints HTML with meta information for the current post-date/time and author.
  */
 function ushipnetwork_posted_on()
 {
     $time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>';
     if (get_the_time('U') !== get_the_modified_time('U')) {
         $time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time>';
     }
     $time_string = sprintf($time_string, esc_attr(get_the_date('c')), esc_html(get_the_date()));
     $posted_on = sprintf(esc_html_x('%s', 'post date', 'ushipnetwork'), $time_string);
     $byline = sprintf(esc_html_x('by %s', 'post author', 'ushipnetwork'), '<span class="author vcard"><a class="url fn n" href="' . esc_url(get_author_posts_url(get_the_author_meta('ID'))) . '">' . esc_html(get_the_author()) . '</a></span>');
     echo '<div class="posted-on">' . $posted_on . '<div class="share">';
     include "share.php";
     echo '</div>' . '</div>';
     echo '<div class="byline">' . '<div class="authorship">' . $byline . '</div>';
     $posttags = get_the_tags();
     $count = 0;
     $separator = ', ';
     $output = '';
     if (!empty($posttags)) {
         echo '<span class="tag-list">tags: ';
         foreach ($posttags as $posttag) {
             $count++;
             if ($count <= 2) {
                 $output .= '<a href="' . esc_url(get_tag_link($posttag->term_id)) . '" alt="' . esc_attr(sprintf(__('View all posts in %s', 'textdomain'), $posttag->name)) . '">' . esc_html($posttag->name) . '</a>' . $separator;
             }
         }
         echo trim($output, $separator);
     }
     echo '</span>' . '</div>';
 }
Example #24
0
 protected function comment($comment, $depth, $args)
 {
     // разметка каждого комментария, без закрывающего </li>!
     $classes = implode(' ', get_comment_class()) . ($comment->comment_author_email == get_the_author_meta('email') ? ' author-comment' : '');
     // берем стандартные классы комментария и если коммент пренадлежит автору поста добавляем класс author-comment
     echo '<li id="li-comment-' . get_comment_ID() . '" class="' . $classes . '">' . "\n";
     // родительский тэг комментария с классами выше и уникальным id
     echo '<div id="comment-' . get_comment_ID() . '">' . "\n";
     // элемент с таким id нужен для якорных ссылок на коммент
     echo get_avatar($comment, 64) . "\n";
     // покажем аватар с размером 64х64
     echo '<p class="meta">Автор: ' . get_comment_author() . "\n";
     // имя автора коммента
     echo ' ' . get_comment_author_email();
     // email автора коммента
     echo ' ' . get_comment_author_url();
     // url автора коммента
     echo ' Добавлено ' . get_the_time('l, F jS, Y') . ' в ' . get_the_time() . '</p>' . "\n";
     // дата и время комментирования
     if ('0' == $comment->comment_approved) {
         echo '<em class="comment-awaiting-moderation">Ваш комментарий будет опубликован после проверки модератором.</em>' . "\n";
     }
     // если комментарий должен пройти проверку
     comment_text() . "\n";
     // текст коммента
     $reply_link_args = array('depth' => $depth, 'reply_text' => 'Ответить', 'login_text' => 'Вы должны быть залогинены');
     echo get_comment_reply_link(array_merge($args, $reply_link_args));
     // выводим ссылку ответить
     echo '</div>' . "\n";
     // закрываем див
 }
Example #25
0
function roots_entry_meta()
{
    echo '<div id="author-info">';
    echo '<time class="updated" datetime="' . get_the_time('c') . '" pubdate>' . sprintf(__('Posted on %s at %s.', 'roots'), get_the_date(), get_the_time()) . '</time>';
    echo '<p class="byline author vcard">' . __('Written by', 'roots') . ' <a href="' . get_author_posts_url(get_the_author_meta('id')) . '" rel="author" class="fn">' . get_the_author() . '</a></p>';
    echo '</div>';
}
Example #26
0
 public function addFiles()
 {
     if (!empty($this->css_files) && is_array($this->css_files) && sizeof($this->css_files) > 0) {
         foreach ($this->css_files as $file) {
             $footer = false;
             if (isset($file['footer']) && $file['footer'] == true) {
                 $footer = true;
             }
             wp_register_style($file['key'], get_template_directory_uri() . $file['url'], $file['deps'], $file['ver'], $file['media']);
             wp_enqueue_style($file['key']);
         }
     }
     if (!empty($this->js_files) && is_array($this->js_files) && sizeof($this->js_files) > 0) {
         foreach ($this->js_files as $file) {
             $footer = false;
             if (isset($file['footer']) && $file['footer'] == true) {
                 $footer = true;
             }
             wp_register_script($file['key'], get_template_directory_uri() . $file['url'], $file['deps'], $file['ver'], $footer);
             wp_enqueue_script($file['key']);
             if (!empty($file['localize']) && is_array($file['localize']) && sizeof($file['localize'] > 0)) {
                 if (is_day()) {
                     $currentDate = get_the_time('Y-m-d');
                 } else {
                     $currentDate = '';
                 }
                 $file['localize']['current_date'] = $currentDate;
                 wp_localize_script($file['key'], 'WPURLS', $file['localize']);
             }
         }
     }
 }
Example #27
0
function blog_summary_shortcode($attr)
{
    // Describes what attributes to parse from shortcode; only 'count'
    extract(shortcode_atts(array('count' => '5', 'grouptag' => 'ul', 'entrytag' => 'li', 'titletag' => 'h4', 'datetag' => 'span', 'commentstag' => 'span', 'summarytag' => 'div'), $attr));
    // Queries to populate our loop based on shortcode count attribute
    $r = new WP_Query("showposts={$count}&what_to_show=posts&nopaging=0&post_status=publish");
    // Only run if we have posts; can't run this through searches
    if ($r->have_posts() && !is_search()) {
        // If we're using a Sandbox-friendly theme . . .
        if (function_exists('sandbox_body_class')) {
            // We can't have double hfeed classes, otherwise it won't parse
            $groupclasses = 'xoxo';
        } else {
            // Otherwise, use hfeed to ensure hAtom compliance
            $groupclasses = 'xoxo hfeed';
        }
        // Begin the output for shortcode and inserts in the group tag what classes we have
        $output = '<' . $grouptag . ' class="' . $groupclasses . '">';
        // Begins our loop for returning posts
        while ($r->have_posts()) {
            // Sets which post from our loop we're at
            $r->the_post();
            // Allows the_date() with multiple posts within a single day
            unset($previousday);
            // If we're using a Sandbox-friendly theme . . .
            if (function_exists('sandbox_post_class')) {
                // Let's use semantic classes with each entry element
                $entryclasses = sandbox_post_class(false);
            } else {
                // Otherwise, use hentry to ensure hAtom compliance
                $entryclasses = 'hentry';
            }
            // Begin entry wrapper and inserts what classes we got from above
            $output .= "\n" . '<' . $entrytag . ' class="' . $entryclasses . '">';
            // Post title
            $output .= "\n" . '<' . $titletag . ' class="entry-title"><a href="' . get_permalink() . '" title="' . sprintf(__('Permalink to %s', 'blog_summary'), the_title_attribute('echo=0')) . '" rel="bookmark">' . get_the_title() . '</a></' . $titletag . '>';
            // Post date with hAtom support
            $output .= "\n" . '<' . $datetag . ' class="entry-date"><abbr class="published" title="' . get_the_time('Y-m-d\\TH:i:sO') . '">' . sprintf(__('%s', 'blog_summary'), the_date('', '', '', false)) . '</abbr></' . $datetag . '>';
            // Comments number
            $output .= "\n" . '<' . $commentstag . ' class="entry-comments"><a href="' . get_permalink() . '#comments" title="' . sprintf(__('Comments to %s', 'blog_summary'), the_title_attribute('echo=0')) . '">' . sprintf(__('Comments (%s)', 'blog_summary'), apply_filters('comments_number', get_comments_number())) . '</a></' . $commentstag . '>';
            // Post excerpt with hAtom support
            $output .= "\n" . '<' . $summarytag . ' class="entry-summary">' . "\n" . apply_filters('the_excerpt', get_the_excerpt()) . '</' . $summarytag . '>';
            // Close each post LI
            $output .= "\n" . '</' . $entrytag . '>';
            // Finish the have_posts() query
        }
        // while ( $r->have_posts() ) :
        // Close the parent UL
        $output .= "\n" . '</' . $grouptag . '>';
        // Rewinds loop from $r->the_post();
        rewind_posts();
        // End the initial IF statement
    }
    // if ( $r->have_posts() ) :
    // Clears our query to put the loop back where it was
    wp_reset_query();
    // $r = new WP_Query()
    // Returns $output to the shortcode
    return $output;
}
Example #28
0
 /**
  * Prints HTML with meta information for the current post-date/time and author.
  */
 function jkl_index_posted_on()
 {
     $time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>';
     if (get_the_time('U') !== get_the_modified_time('U')) {
         $time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time><time class="updated" datetime="%3$s">%4$s</time>';
     }
     $time_string = sprintf($time_string, esc_attr(get_the_date('c')), esc_html(get_the_date()), esc_attr(get_the_modified_date('c')), esc_html(get_the_modified_date()));
     $byline = sprintf(esc_html('%s'), '<span class="author vcard"><a class="url fn n" href="' . esc_url(get_author_posts_url(get_the_author_meta('ID'))) . '">@' . esc_html(get_the_author()) . '</a></span>');
     if ('chat' === get_post_format() || 'image' === get_post_format() || 'gallery' === get_post_format() || 'audio' === get_post_format() || 'video' === get_post_format()) {
         $string = ucwords(get_post_format());
         $posted_on = $string . ': <a href="' . esc_url(get_permalink()) . '" rel="bookmark">' . $time_string . '</a>';
     } else {
         $posted_on = sprintf(esc_html_x('Date: %s', 'post date', 'jkl'), '<a href="' . esc_url(get_permalink()) . '" rel="bookmark">' . $time_string . '</a>');
     }
     $meta_class = is_single() ? 'format-small-meta' : 'meta-content-index';
     echo '<div class="' . $meta_class . '">';
     echo '<span class="posted-on">' . $posted_on . '</span>';
     // WPCS: XSS OK.
     if (is_single()) {
         echo '<span class="byline">' . $byline . '</span>';
         if (!has_post_format('quote')) {
             jkl_better_taxonomy_listing('category', 1);
         }
     }
     echo '</div><!-- .meta-content-index -->';
 }
function bavota_breadcrumbs()
{
    if (!is_front_page()) {
        echo '<a href="' . home_url('/') . 'blog">Blog</a><span class="divider"> <i class="icon-angle-right"></i> </span>';
    }
    if (is_category() || is_single()) {
        $category = get_the_category();
        $ID = $category[0]->cat_ID;
        // echo get_category_parents($ID, TRUE, ' ', FALSE ); // was causing errors in the error_log
        echo is_wp_error($cat_parents = get_category_parents($ID, TRUE, ' ', FALSE)) ? '' : $cat_parents;
    }
    $mytitle = get_the_title();
    if (strlen($mytitle) > 22) {
        $mytitle = substr($mytitle, 0, 38) . "...";
    }
    if (is_single() || is_page()) {
        echo ' <span class="divider"> <i class="icon-angle-right"></i> </span> ';
        echo $mytitle;
    }
    if (is_tag()) {
        echo "Tag: " . single_tag_title('', FALSE);
    }
    if (is_404()) {
        echo "404 - Page not Found";
    }
    if (is_search()) {
        echo "Search";
    }
    if (is_year()) {
        echo get_the_time('Y');
    }
}
Example #30
0
    /**
     * Prints HTML with meta information for the current post-date/time and author.
     */
    function river_radio_posted_on()
    {
        $time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>';
        if (get_the_time('U') !== get_the_modified_time('U')) {
            $time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time><time class="updated" datetime="%3$s">%4$s</time>';
        }
        $time_string = sprintf($time_string, esc_attr(get_the_date('c')), esc_html(get_the_date()), esc_attr(get_the_modified_date('c')), esc_html(get_the_modified_date()));
        $posted_on = sprintf(esc_html_x('%s', 'post date', 'river-radio'), '<a href="' . esc_url(get_permalink()) . '" rel="bookmark">' . $time_string . '</a>');
        $byline = sprintf(esc_html_x('%s', 'post author', 'river-radio'), '<span class="author vcard"><a class="url fn n" href="' . esc_url(get_author_posts_url(get_the_author_meta('ID'))) . '">' . esc_html(get_the_author()) . '</a></span>');
        echo '<span class="byline icons"><i class="fa fa-headphones"></i>
 ' . $byline . '</span><span class="posted-on icons"><i class="fa fa-calendar"></i>
' . $posted_on . '</span>';
        // WPCS: XSS OK.
        if ('post' === get_post_type()) {
            $tags_list = get_the_tag_list('', esc_html__(', ', 'river-radio'));
            if ($tags_list) {
                printf('<span class="tags-links icons"><i class="fa fa-music"></i>
' . esc_html__('%1$s', 'river-radio') . '</span>  ', $tags_list);
                // WPCS: XSS OK.
            }
            $categories_list = get_the_category_list(esc_html__(', ', 'river-radio'));
            if ($categories_list && river_radio_categorized_blog()) {
                printf('<span class="cat-links icons"><i class="fa fa-map-marker"></i>
' . esc_html__('%1$s', 'river-radio') . '</span>', $categories_list);
                // WPCS: XSS OK.
            }
        }
    }