ThemeShaper Forums » Thematic

[closed]

Help with post footer customisation

(14 posts)
  • Started 8 years ago by ollie
  • Latest reply from ollie
  • This topic is resolved
  1. Hi Guys,

    I'm trying to customise my post footer and I can't quite get it right. I'm hoping that someone can suggest a chunk a code for my child theme that will solve the problem, here's how I want it to look:

    This entry was posted in *category*
    Bookmark the permalink | Leave a trackback: Trackback URL

    I want to omit all of the 'post a comment' and 'tagged' stuff.

    All help will be gladly received!

    Thanks alot

    Ollie

    Posted 8 years ago #
  2. hi ollie,

    using the latest svn version here

    you can use childtheme overide functions more info here

    i've tested the following and it works for me

    function childtheme_override_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_postconnect();
    	        } else {
    	            $postfooter = '<div class="entry-utility">' . thematic_postfooter_postcategory();
    	        }
    	        $postfooter .= "</div><!-- .entry-utility -->\n";
    	    }
    
    	    // Put it on the screen
    	    echo apply_filters( 'thematic_postfooter', $postfooter ); // Filter to override default post footer
    
    } // end postfooter
    
    function childtheme_override_postfooter_postconnect() {
    	    $postconnect = __('. Bookmark the ', 'thematic') . '<a href="' . apply_filters('the_permalink', get_permalink()) . '" title="' . __('Permalink to ', 'thematic') . the_title_attribute('echo=0') . '">';
    	    $postconnect .= __('permalink', 'thematic') . '</a>.';
    
    	    // Display edit link on single posts
    	    if (current_user_can('edit_posts')) {
    	        $postconnect .= ' ' . thematic_postfooter_posteditlink();
    	    }
    	    return apply_filters('thematic_postfooter_postconnect',$postconnect); 
    
    } // end postfooter_postconnect

    let me know how you get on

    Posted 8 years ago #
  3. also, if you'd like to change the text "This entry was posted in"
    paste function below and adjust the three fields for single and category pages
    in the example, i've changed it to display "filed in"

    function childtheme_override_postfooter_postcategory() {
    	    $postcategory = '<span class="cat-links">';
    	    if (is_single()) {
    	        $postcategory .= __('Filed 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 filed in ', 'thematic') . $cats_meow;
    	        $postcategory .= '</span> <span class="meta-sep meta-sep-tag-links">|</span>';
    	    } else {
    	        $postcategory .= __('Filed in ', 'thematic') . get_the_category_list(', ');
    	        $postcategory .= '</span> <span class="meta-sep meta-sep-tag-links">|</span>';
    	    }
    	    return apply_filters('thematic_postfooter_postcategory',$postcategory); 
    
    }  // end postfooter_postcategory
    Posted 8 years ago #
  4. Hi Jonny,

    Thanks alot for your reply. I've added the code to my child theme but the post footer is showing the same as before.

    I'm running WordPress 3.0.1 and Thematic 0.9.6.2. I think I may need to grab a newer version from the thematic4you site, is this correct? Don't wanna get it wrong as I'm no expert!

    Thanks again

    Ollie

    Posted 8 years ago #
  5. yes, it doesn't work because the 'childtheme_override' function doesn't exsist in that release.
    grab latest copy from the link i provided above. it will work.

    Posted 8 years ago #
  6. Hi Jonny,

    Right, new version is installed and working. It's almost there, I can't see the trackback link showing, is it working for you?

    With regards layout, I'd like to have the 'posted in' text on one line and then the 'permalink' and 'trackback' text on the line below, is it possible to do this? Also, I'd like to have the '|' character instead of the '.' character as a separator.

    Really appreciate your assistance with this one!

    Cheers

    Ollie

    Posted 8 years ago #
  7. ok, misread you wanted to keep trackback link

    this is the code for your functions.php

    function childtheme_override_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_postconnect();
    	        } else {
    	            $postfooter = '<div class="entry-utility">' . thematic_postfooter_postcategory();
    	        }
    	        $postfooter .= "</div><!-- .entry-utility -->\n";
    	    }
    
    	    // Put it on the screen
    	    echo apply_filters( 'thematic_postfooter', $postfooter ); // Filter to override default post footer
    
    } // end postfooter
    
    function childtheme_override_postfooter_postconnect() {
    	    $postconnect = __('Bookmark the ', 'thematic') . '<a href="' . apply_filters('the_permalink', get_permalink()) . '" title="' . __('Permalink to ', 'thematic') . the_title_attribute('echo=0') . '">';
    	    $postconnect .= __('permalink', 'thematic') . '</a><span class="meta-sep meta-sep-tag-links"> | </span>';
    	    if ((comments_open()) && (pings_open())) { /* Comments are open */
    	        $postconnect .= __('Leave a trackback: ', 'thematic');
    	        $postconnect .= '<a class="trackback-link" href="' . get_trackback_url() . '" title ="' . __('Trackback URL for your post', 'thematic') . '" rel="trackback">' . __('Trackback URL', 'thematic') . '</a>';
    	    } elseif (!(comments_open()) && (pings_open())) { /* Only trackbacks are open */
    	        $postconnect .= __('Leave a trackback: ', 'thematic');
    	        $postconnect .= '<a class="trackback-link" href="' . get_trackback_url() . '" title ="' . __('Trackback URL for your post', 'thematic') . '" rel="trackback">' . __('Trackback URL', 'thematic') . '</a>';
    	    }
    	    // Display edit link on single posts
    	    if (current_user_can('edit_posts')) {
    	        $postconnect .= ' ' . thematic_postfooter_posteditlink();
    	    }
    	    return apply_filters('thematic_postfooter_postconnect',$postconnect); 
    
    } // end postfooter_postconnect
    
    function childtheme_override_postfooter_postcategory() {
    	    $postcategory = '<span class="cat-links">';
    	    if (is_single()) {
    	        $postcategory .= __('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>';
    	    }
    	    return apply_filters('thematic_postfooter_postcategory',$postcategory); 
    
    }  // end postfooter_postcategory

    also, in your css file you need to add

    .cat-links {
    	display:block;
    }

    this will seperate category links and bookmark to seperate lines

    tested here
    http://www.dev.virtualpudding.com/

    for future ref... check out
    http://thematic.googlecode.com/svn/trunk/library/extensions/content-extensions.php

    it includes the functions that thematic uses to display content
    by using childtheme_override's you can manipulate this to how you want it to look.
    it can take some time to get your head around but when it clicks, you'll be moulding your themes quicker than ever

    hope this works for you

    Posted 8 years ago #
  8. oh, by the way, if this does solve it, please remember to mark this post as resolved

    Posted 8 years ago #
  9. Hi Jonny,

    Thanks for that, it's working nicely. A couple of oddities have occurred since upgrading to the latest SVN:

    1. I had some code in my functions.php to add a 'Home' link to the main menu, this now breaks the menu.

    2. My links no longer shown in the sidebar. I have tried to put them in with the widget but without success.

    Any ideas on these?

    Posted 8 years ago #
  10. 11thinking
    Member

    You should now use this code to add "HOME" to menu:

    function childtheme_menu_args($args) {
        $args = array(
            'show_home' => 'Home',
            'sort_column' => 'menu_order',
            'menu_class' => 'menu',
            'echo' => false
        );
        return $args;
    }
    add_filter('wp_page_menu_args','childtheme_menu_args');

    As found here: Breaking things to fix others

    Posted 8 years ago #
  11. 11thinking
    Member

    As for your other question: read this topic. Looks like it's fixed and will work for r710 and up.

    Posted 8 years ago #
  12. Thanks 11thinking, home page problem is resolved.

    How can I get r715? I've downloaded the latest development release version from thematic4you but this one isn't working.

    Cheers

    Ollie

    Posted 8 years ago #
  13. 11thinking
    Member

    Hi Ollie, here's the tutorial on how to get the latest SVN copy. I just checked that the latest revision is r718.

    Please note that a SVN copy is not fully tested, therefore I'd rather use the more stable development version. This sticky post explains the difference.

    Posted 8 years ago #
  14. Hi 11thinking, many thanks for the info.

    I've managed to grab the updated file (r715) from the Google code site and replaced the existing file in my Thematic install folder which has sorted the problem. This probably isn't quite the right way but it's done the trick so I'll leave things as they are until the next stable release comes out.

    Thanks again to you and to Jonny Janeiro, all your help is hugely appreciated.

    Ollie

    Posted 8 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.