Permalink
Browse files

Updated post metadata

  • Loading branch information...
awmartin committed Apr 2, 2017
1 parent f50ec53 commit e86d6de0c8a54b29073ed6e05371e71b658b7e77
Showing with 63 additions and 43 deletions.
  1. +26 −26 null.post.php
  2. +37 −17 null.postmeta.php
@@ -11,19 +11,19 @@ function NullPostSidebar() {
function NullPostContent($more=false) {
$content = "";
if ($more) {
$content = get_post_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'null' ) );
$content = getPostContent( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'null' ) );
} else {
$content = get_post_content();
$content = getPostContent();
}
return $content;
}
function get_post_content($more_link_text = null, $stripteaser = false){
// Emulates the_content() without being stupid.
$content = get_the_content($more_link_text, $stripteaser);
$content = apply_filters('the_content', $content);
$content = str_replace(']]>', ']]&gt;', $content);
return $content;
function getPostContent($more_link_text = null, $stripteaser = false){
// Emulates the_content() without being stupid.
$content = get_the_content($more_link_text, $stripteaser);
$content = apply_filters('the_content', $content);
$content = str_replace(']]>', ']]&gt;', $content);
return $content;
}
function NullPostPagination() {
@@ -36,7 +36,7 @@ function NullPostPagination() {
}
function NullReadMoreLink() {
return NullTag('p', NullLink('Read more...', get_permalink()), array('class' => 'read-more'));
return NullLink('Read more...', get_permalink());
}
function NullExcerpt($attr=null) {
@@ -161,24 +161,24 @@ function NullPostThumbnailUrl($size='thumbnail') {
}
function NullPostThumbnail($size='medium', $placeholder=false) {
if (hasThumbnail()) {
$permalink = get_permalink();
$thumbnail = get_the_post_thumbnail(get_the_ID(), $size); // <img />
if (hasThumbnail()) {
$permalink = get_permalink();
$thumbnail = get_the_post_thumbnail(get_the_ID(), $size); // <img />
$linkAttr = array('href' => $permalink);
$content = NullTag('a', $thumbnail, $linkAttr);
$linkAttr = array('href' => $permalink);
$content = NullTag('a', $thumbnail, $linkAttr);
$attr = array('class' => 'thumbnail');
return NullTag('div', $content, $attr);
$attr = array('class' => 'thumbnail');
return NullTag('div', $content, $attr);
} else {
if ($placeholder) {
$attr = array('class' => 'thumbnail empty');
return NullTag('div', '&nbsp;', $attr);
} else {
if ($placeholder) {
$attr = array('class' => 'thumbnail empty');
return NullTag('div', '&nbsp;', $attr);
} else {
$attr = array('class' => 'thumbnail empty');
return NullTag('div', '<!--no thumbnail here-->', $attr);
}
$attr = array('class' => 'thumbnail empty');
return NullTag('div', '<!--no thumbnail here-->', $attr);
}
}
}
function NullPostFormat() {
@@ -228,9 +228,9 @@ function NullPostLink($content, $options=array()) {
function NullComments($args=array()) {
ob_start();
// If comments are open or we have at least one comment, load up the comment template
if ( comments_open() || '0' != get_comments_number() )
if (comments_open()) :
comments_template();
endif;
$comments = ob_get_contents();
ob_end_clean();
@@ -243,6 +243,6 @@ function NullComments($args=array()) {
if (array_key_exists('after', $args)) {
$after = $args['after'];
}
return $before.$comments.$after;
return $before . $comments . $after;
}
?>
@@ -1,24 +1,44 @@
<?php
function get_null_posted_on() {
return sprintf( __( 'Posted on <a href="%1$s" title="%2$s" rel="bookmark"><time class="entry-date" datetime="%3$s">%4$s</time></a><span class="byline"> by <span class="author vcard"><a class="url fn n" href="%5$s" title="%6$s" rel="author">%7$s</a></span></span>', 'null' ),
esc_url( get_permalink() ),
esc_attr( get_the_time() ),
esc_attr( get_the_date( 'c' ) ),
esc_html( get_the_date() ),
esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
esc_attr( sprintf( __( 'View all posts by %s', 'null' ), get_the_author() ) ),
get_the_author()
);
function getNullPostedOn($by='$middot;') {
$authorId = get_the_author_meta( 'ID' );
$authorUrl = esc_url(get_author_posts_url($authorId));
$datetime = esc_attr(get_the_date('c'));
$dateHtml = esc_html(get_the_date());
$link = esc_url( get_permalink() );
$author = get_the_author();
$posted =
NullTag('a',
NullTag('time', $dateHtml, array('datetime' => $datetime))
, array('href' => $link, 'rel' => 'bookmark'))
. ' ' . $by . ' '
. NullTag('span',
NullTag('a', $author, array('class' => 'url fn n', 'rel' => 'author', 'href' => $authorUrl))
, array('class' => 'author vcard'));
return $posted;
}
// Returns HTML that shows "Posted on YYYY-MM-DD by Author"
function NullPostedOn() {
return NullTag(
'div',
get_null_posted_on(),
array('class' => 'post-meta')
);
function NullPostedOn($options=array()) {
$before = '';
if (array_key_exists('before', $options)):
$before = $options['before'] . ' ';
endif;
$after = '';
if (array_key_exists('before', $options)):
$after = ' ' . $options['after'];
endif;
$by = '&middot;';
if (array_key_exists('by', $options)):
$by = ' ' . $options['by'];
endif;
return NullTag('div',
$before . getNullPostedOn($by) . $after,
array('class' => 'post-meta'));
}
function NullPostTags(){
@@ -73,7 +93,7 @@ function NullPostCategories($args=array()) {
if ($html) {
$cats[] = format_category($category, $args);
} else {
$cats[] = $category->name;
$cats[] = esc_html($category->name);
}
}
}

0 comments on commit e86d6de

Please sign in to comment.