ThemeShaper Forums » Thematic

Move entry-meta to postfooter?

(2 posts)
  • Started 5 years ago by McGirl2008
  • Latest reply from McGirl2008
  • This topic is not resolved
  1. Hi,

    I want to move the entry-meta (date, author name) into the posts' footers on index pages only, where I'm displaying the posts as excerpts. I'm also adding some other meta data into the footer at the same time - a category icon, post-views counter, and js-kit-ratings.

    I've tried rewriting thematic_postfooter (as childtheme_postfooter in my child theme's functions file) to add a few more variables such as $entrymetadate and $entrymetaauthor, along with the other stuff I need, but I've got myself hopelessly jumbled.

    If anyone has time to look at this scary code I'd really appreciate it!!

    // CHANGE POST FOOTER TO INCLUDE META DATA, RATINGS, CATEGORY ICON, PAGE VIEWS
    function childtheme_postfooter() {
    global $id, $post;

    // Create $posteditlink
    $posteditlink .= '<span class="edit"><a href="' . get_bloginfo('wpurl') . '/wp-admin/post.php?action=edit&post=' . $id;
    $posteditlink .= '" title="' . __('Edit post', 'thematic') .'">';
    $posteditlink .= __('Edit', 'thematic') . '</span>';
    $posteditlink = apply_filters('thematic_postfooter_posteditlink',$posteditlink);

    // Display the post categories
    $postcategory .= '<span class="cat-links">';
    if (is_single()) {
    $postcategory .= __('This entry was posted in ', 'thematic') . get_the_category_list(', ');
    $postcategory .= '</span>';
    } elseif ( is_category() && $cats_meow = thematic_cats_meow(', ') ) { /* Returns categories other than the one queried */
    $postcategory .= __('Also posted in ', 'thematic') . $cats_meow;
    $postcategory .= '</span> <span class="meta-sep meta-sep-tag-links">|</span>';
    } else {
    $postcategory .= __('Posted in ', 'thematic') . get_the_category_list(', ');
    $postcategory .= '</span> <span class="meta-sep meta-sep-tag-links">|</span>';
    }
    $postcategory = apply_filters('thematic_postfooter_postcategory',$postcategory);

    // Display the tags
    if (is_single()) {
    $tagtext = __(' and tagged', 'thematic');
    $posttags = get_the_tag_list('<span class="tag-links"> $tagtext ',', ','</span>');
    } elseif ( is_tag() && $tag_ur_it = thematic_tag_ur_it(', ') ) { /* Returns tags other than the one queried */
    $posttags = '<span class="tag-links">' . __(' Also tagged ', 'thematic') . $tag_ur_it . '</span> <span class="meta-sep meta-sep-comments-link">|</span>';
    } else {
    $tagtext = __('Tagged', 'thematic');
    $posttags = get_the_tag_list('<span class="tag-links"> $tagtext ',', ','</span> <span class="meta-sep meta-sep-comments-link">|</span>');
    }
    $posttags = apply_filters('thematic_postfooter_posttags',$posttags);

    // Display comments link and edit link
    if (comments_open()) {
    $postcommentnumber = get_comments_number();
    if ($postcommentnumber > '1') {
    $postcomments = ' <span class="comments-link">';
    $postcomments .= get_comments_number() . __(' Comments', 'thematic') . '
    </span>';
    } elseif ($postcommentnumber == '1') {
    $postcomments = ' <span class="comments-link">';
    $postcomments .= get_comments_number() . __(' Comment', 'thematic') . '
    </span>';
    } elseif ($postcommentnumber == '0') {
    $postcomments = ' <span class="comments-link">';
    $postcomments .= __('Leave a comment', 'thematic') . '
    </span>';
    }
    } else {
    $postcomments = ' <span class="comments-link comments-closed-link">' . __('Comments closed', 'thematic') .'</span>';
    }
    // Display edit link
    if (current_user_can('edit_posts')) {
    $postcomments .= ' <span class="meta-sep meta-sep-edit">|</span> ' . $posteditlink;
    }
    $postcomments = apply_filters('thematic_postfooter_postcomments',$postcomments);

    // Display permalink, comments link, and RSS on single posts
    $postconnect .= __('. Bookmark the ', 'thematic') . '';
    $postconnect .= __('permalink', 'thematic') . '
    .';
    if (('open' == $post-> comment_status) && ('open' == $post->ping_status)) { /* Comments are open */
    $postconnect .= ' ' . __('Post a comment', 'thematic') . '';
    $postconnect .= __(' or leave a trackback: ', 'thematic');
    $postconnect .= '' . __('Trackback URL', 'thematic') . '.';
    } elseif (!('open' == $post-> comment_status) && ('open' == $post->ping_status)) { /* Only trackbacks are open */
    $postconnect .= __(' Comments are closed, but you can leave a trackback: ', 'thematic');
    $postconnect .= '' . __('Trackback URL', 'thematic') . '.';
    } elseif (('open' == $post-> comment_status) && !('open' == $post->ping_status)) { /* Only comments open */
    $postconnect .= __(' Trackbacks are closed, but you can ', 'thematic');
    $postconnect .= '' . __('post a comment', 'thematic') . '.';
    } elseif (!('open' == $post-> comment_status) && !('open' == $post->ping_status)) { /* Comments and trackbacks closed */
    $postconnect .= __(' Both comments and trackbacks are currently closed.', 'thematic');
    }
    // Display edit link on single posts
    if (current_user_can('edit_posts')) {
    $postconnect .= ' ' . $posteditlink;
    }
    $postconnect = apply_filters('thematic_postfooter_postconnect',$postconnect);

    //ADD META, PAGE VIEWS, CATEGORY ICON, RATINGS
    if ($post->post_type == 'post') { // Hide entry meta on searches

    // Display date and author
    $entrymetadate = '<div class="entry-meta">';
    $entrymetadate .= '<!-- date --><span class="entry-date">';
    $entrymetadate .= '<abbr class="published" title="' . get_the_time('Y-m-d\TH:i:sO') . '">';

    if (function_exists('relative_post_the_date')) {
    $postDate = relative_post_the_date('F j, Y','','','true','true');
    $entrymetadate .= ($postDate == "Today" ? relative_post_time('', 1) : $postDate);
    } else {
    $entrymetadate .= get_the_time('Y-m-d\TH:i:sO');
    }
    $entrymetadate .= '</abbr></span><!-- end date -->';
    $entrymetaauthor .= '<!-- author --><span class="author vcard">' . $author = get_the_author() . _e('', 'thematic');
    $entrymetaauthor .= '<span class="fn n">' . _e('$author');
    $entrymetaauthor .= '</span></span><!-- BOOM end author -->';
    $entrymetaauthor .= '</div><!-- .entry-meta -->';

    // Display page view, category icon
    $viewsblock = '<div class="b43viewsblock">';
    $viewsblock .= '<!--adds page views -->';
    $viewsblock .= '<div id="pgview"><p>';
    if(function_exists('the_views')) {
    $viewsblock .= the_views();
    }
    $viewsblock .= '</p></div><!--end page views-->';
    $viewsblock .= '<!--category icon--><div id="caticon">';
    if (function_exists('get_cat_icon')) {
    $viewsblock .= get_cat_icon();
    }
    $viewsblock .= '</div><!--end category icon-->';
    $viewsblock .= '</div>';

    $jskitratings = '<!--adds ratings--><div class="js-kit-rating" permalink="' . the_permalink();
    $jskitratings .= '" uniq="' . the_title() . '" title="' . the_title() . '"></div>';
    $jskitratings .= '<!--end add ratings--></div>';

    }
    // Add it all up
    if ($post->post_type == 'page' && current_user_can('edit_posts')) { /* For logged-in "page" search results */
    $postfooter = '<div class="entry-utility">' . '<span class="edit">' . $posteditlink . '</span>';
    $postfooter .= '</div><!-- .entry-utility -->';
    } elseif ($post->post_type == 'page') { /* For logged-out "page" search results */
    $postfooter = '';
    } else {
    if (is_single()) {
    $postfooter = '<div class="entry-utility">' . $postcategory . $posttags . $postconnect;
    } else {
    $postfooter = $viewsblock . '<div class="entry-utility">' . $jskitratings . $posttags . $entrymetadate . $entrymetaauthor . $postcategory . $postconnect;
    }
    $postfooter .= '</div><!-- .entry-utility -->';
    }
    return $postfooter;
    }
    add_action('thematic_postfooter','childtheme_postfooter');

    Posted 5 years ago #
  2. Never mind! I've found a workaround. I'd still like to figure out how to move elements like the author name, date etc that are currently in the $postheader to the $postfooter (or elsewhere) but it'll wait for another day. :)

    Posted 5 years ago #

RSS feed for this topic

Reply

You must log in to post.