ThemeShaper Forums » Thematic

[closed]

Adding date to postfooter

(9 posts)
  • Started 10 years ago by HuskerLiz
  • Latest reply from yilmaznakliyat
  • This topic is resolved
  1. HuskerLiz
    Member

    How do I use either child css or child function.php to add the date to the postfooter?

    Posted 10 years ago #
  2. You have to filter the thematic_postfooter (in functions.php) in this way:

    // NEW POST FOOTER
    function YOURCHILDTHEME_postfooter() {
        global $id, $post;
    
        // Create $posteditlink
        $posteditlink .= '<a href="' . get_bloginfo('wpurl') . '/wp-admin/post.php?action=edit&amp;post=' . $id;
        $posteditlink .= '" title="' . __('Edit post', 'thematic') .'">';
        $posteditlink .= __('Edit', 'thematic') . '</a>';
        $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> ';
        } else {
            $postcategory .= __('Posted in ', 'thematic') . get_the_category_list(', ');
            $postcategory .= '</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">|</span>';
        } else {
            $tagtext = __('Tagged', 'thematic');
            $posttags = get_the_tag_list("<span class=\"meta-sep\">|</span> <span class=\"tag-links\"> $tagtext ",', ','</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="meta-sep">|</span> <span class="comments-link"><a href="' . get_permalink() . '#comments" title="' . __('Comment on ', 'thematic') . the_title_attribute('echo=0') . '">';
                $postcomments .= get_comments_number() . __(' Comments', 'thematic') . '</a></span>';
            } elseif ($postcommentnumber == '1') {
                $postcomments = ' <span class="meta-sep">|</span> <span class="comments-link"><a href="' . get_permalink() . '#comments" title="' . __('Comment on ', 'thematic') . the_title_attribute('echo=0') . '">';
                $postcomments .= get_comments_number() . __(' Comment', 'thematic') . '</a></span>';
            } elseif ($postcommentnumber == '0') {
                $postcomments = '<span class="no-comment"><a href="' . get_permalink() . '#comments" title="' . __('Comment on ', 'thematic') . the_title_attribute('echo=0') . '">';
                $postcomments .= __('Leave a comment', 'thematic') . '</a></span>';
            }
        } else {
            $postcomments = ' <span class="comments-link">' . __('Comments closed', 'thematic') .'</span>';
        }
        // Display edit link
        if (current_user_can('edit_posts')) {
            $postcomments .= ' <span class="meta-sep">|</span> ' . $posteditlink;
        }
        $postcomments = apply_filters('thematic_postfooter_postcomments',$postcomments); 
    
        // Display permalink, comments link, and RSS on single posts
        $postconnect .= __('. Bookmark the ', 'thematic') . '<a href="' . get_permalink() . '" title="' . __('Permalink to ', 'thematic') . the_title_attribute('echo=0') . '">';
        $postconnect .= __('permalink', 'thematic') . '</a>.';
        if (('open' == $post-> comment_status) && ('open' == $post->ping_status)) { /* Comments are open */
            $postconnect .= ' <a class="comment-link" href="#respond" title ="' . __('Post a comment', 'thematic') . '">' . __('Post a comment', 'thematic') . '</a>';
            $postconnect .= __(' or leave a trackback: ', 'thematic');
            $postconnect .= '<a class="trackback-link" href="' . trackback_url(FALSE) . '" title ="' . __('Trackback URL for your post', 'thematic') . '" rel="trackback">' . __('Trackback URL', 'thematic') . '</a>.';
        } 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 .= '<a class="trackback-link" href="' . trackback_url(FALSE) . '" title ="' . __('Trackback URL for your post', 'thematic') . '" rel="trackback">' . __('Trackback URL', 'thematic') . '</a>.';
        } elseif (('open' == $post-> comment_status) && !('open' == $post->ping_status)) { /* Only comments open */
            $postconnect .= __(' Trackbacks are closed, but you can ', 'thematic');
            $postconnect .= '<a class="comment-link" href="#respond" title ="' . __('Post a comment', 'thematic') . '">' . __('post a comment', 'thematic') . '</a>.';
        } 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 it all up
        if ($post->post_type == 'page' && current_user_can('edit_posts')) { /* For logged-in "page" search results */
            $postfooter = '<div class="entry-utility">' . $posteditlink;
            $postfooter .= "</div><!-- .entry-utility -->\n";
        } 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 = '<div class="entry-utility">' . $postcategory . $posttags . $postcomments;
            }
            $postfooter .= "</div><!-- .entry-utility -->\n";
        }
    
        // Put it on the screen
        echo apply_filters( 'YOURCHILDTHEME_postfooter', $postfooter ); // Filter to override default post footer
    }
    add_filter ('thematic_postfooter', 'YOURCHILDTHEME_postfooter'); // Crazy important!
    // end NEW POST FOOTER

    and edit the code to fit your needs...

    Posted 10 years ago #
  3. HuskerLiz
    Member

    Thanks! I'm so glad that I ask for help because I would never have gotten to this! I appreciate your generosity of time and skills.

    Posted 10 years ago #
  4. As important as postheader and postfooter are, it's an enormous pain to modify it. Wading through code like this doesn't make it much easier.

    Seems like having the options available through the admin interface would make life soooo much easier. Hope someone, someday, finds this a worthy challenge.

    Posted 10 years ago #
  5. Sorry, double post.

    Posted 10 years ago #
  6. @ dannydamnboy

    Just wanted to give you a HUGE thanks for posting the above. It's EXACTLY what I needed!

    THANK YOU!

    Posted 10 years ago #
  7. Thanks from me too! I kinda figured it out on my own but this validated my work!

    Posted 9 years ago #
  8. Hi,

    .. but don't forget .. in most cases you should use the rapier instead of the two-handed sword ;)

    .. or instead of the lupara like my Italian friend :)

    So .. if you just want to add a singe information it should be enough to use one of the 'small' filters.

    Chris

    Posted 9 years ago #
  9. thanks.very good information.

    Posted 8 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.