ThemeShaper Forums » Thematic


How to move post entry date to post footer using new sub functions?

(4 posts)
  • Started 10 years ago by knitatoms
  • Latest reply from patrick
  • This topic is resolved
  1. knitatoms

    In my child theme I want the posts date to be displayed in the post footer. I have tried to use the new sub functions as described in the announcement:

    However I don't know the syntax for removing a sub function - it seems to be different from removing a function?

    In essence - what I want is thematic_postmeta_entrydate() to be displayed as part of thematic_postfooter()

    Any help gratefully received!

    Posted 10 years ago #
  2. patrick


    This is how I would do it, if there's a better solution I'm happy to hear it, we're all here to learn to work with thematic.
    In that case, you actually do not need to remove a function, just filtered it.

    First you need to filter the thematic_postheader_postmeta function to remove the display of thematic_postmeta_entrydate.

    Copy and paste the code below in your function.php file, removing the line mentioned :

    // REMOVE thematic_postmeta_entrydate
    function my_postheader_postmeta() {
        $postmeta = '<div class="entry-meta">';
        $postmeta .= thematic_postmeta_authorlink();
        $postmeta .= '<span class="meta-sep meta-sep-entry-date"> | </span>';
        $postmeta .= thematic_postmeta_entrydate(); // REMOVE THIS LINE
        $postmeta .= thematic_postmeta_editlink();
        $postmeta .= "</div><!-- .entry-meta -->\n";
        return $postmeta; 
    } // end my_postheader_postmeta

    Now the date of your posts should not be displayed anymore.

    Then you have to filter the thematic_postfooter function and put the date inside. Again copy paste and change what you need :

    // ADD thematic_postmeta_entrydate
    function my_postfooter() {
        global $id, $post;
        if ($post->post_type == 'page' && current_user_can('edit_posts')) { /* For logged-in "page" search results */
            $postfooter = '<div class="entry-utility">' . thematic_postfooter_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">' . thematic_postfooter_postcategory() . thematic_postfooter_posttags() . thematic_postfooter_postconnect() .
                  thematic_postmeta_entrydate(); // INSERT THIS LINE AND CAREFUL TO POINT AND SEMICOLON
            } else {
                $postfooter = '<div class="entry-utility">' . thematic_postfooter_postcategory() . thematic_postfooter_posttags() . thematic_postfooter_postcomments() .
                  thematic_postmeta_entrydate();  // INSERT THIS LINE AND CAREFUL TO POINT AND SEMICOLON
            $postfooter .= "</div><!-- .entry-utility -->\n";
        return $postfooter;
    } // end my_postfooter

    That should do it !


    Posted 10 years ago #
  3. knitatoms

    Brilliant! Many thanks Patrick - that works a treat. I was nearly there and had already managed to remove the entry date from the post header but I was still stuck on adding to the footer.

    Many thanks for taking the time to post a solution.

    Posted 10 years ago #
  4. patrick

    Glad I could help !


    Posted 10 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.