ThemeShaper Forums » Thematic

[closed]

thematic_postfooter sub-function reference?

(6 posts)
  • Started 9 years ago by elshaddai
  • Latest reply from elshaddai
  • This topic is not resolved
  1. I was excited to see the new sub-functions for postheader and postfooter as part of the new release. When I adopted Chris' example of editing thematic_postheader in 0961, as shown here, for thematic_postfooter, I ended up with this:

    function my_postfooter() {
    
    $postfooter = '<div class="entry-utility">' . thematic_postfooter_postcategory() . '&nbsp;' . thematic_postfooter_posteditlink() . '</div>';
    return $postfooter;
    }
    add_filter('thematic_postfooter', 'my_postfooter' );

    Note that's a global change to show only the category list and edit link in the utility section. I had to add the div class statements in, as well as add an extra space character before the edit link so that it didn't cram up against the "|" separator.

    As such, everything appears fine on my home blog page, which is displaying excerpts, but when I view the single post, I've lost the "|" divider between the category and edit links. Is there a reference somewhere as to when the dividers and/or spaces are included with the sub-functions and when they're not?

    FWIW, I ended up with the following to address the single post view difference as well as the logged in user scenarios:

    if (is_single()&current_user_can('edit_posts')) {
        $postfooter = '<div class="entry-utility">' . thematic_postfooter_postcategory() . '&nbsp;|&nbsp;' . thematic_postfooter_posteditlink() . '</div>';
    } elseif (current_user_can('edit_posts')) {
        $postfooter = '<div class="entry-utility">' . thematic_postfooter_postcategory() . '&nbsp;' . thematic_postfooter_posteditlink() . '</div>';
    } else {
        $postfooter = '<div class="entry-utility">' . thematic_postfooter_postcategory() . '</div>';
    }
    return $postfooter;

    Is the approach I've taken the correct approach for this new functionality? Or is there an easier way to suppress a sub-function from the existing functions (for example, removing just the comment link from postfooter)?

    Posted 9 years ago #
  2. ## post deleted by author ##

    Posted 9 years ago #
  3. Okay, I've been playing around with this for a bit and while I've used a few variations of the code above, the issue seems to boil down to the fact that the separator "|" is defined as part of thematic_postfooter_postcategory() in the content extensions file. So, if I want to show thematic_postfooter_postcategory() as the only item in postfooter (and I'm acting as a logged-out user so that there's no Edit link), I have to figure out how to either strip the separator or completely redefine thematic_postfooter_postcategory() in order to avoid the trailing "|". I've done the latter before for other sites and was really hoping to not have to do that with these new sub-functions.

    Posted 9 years ago #
  4. Is reassembling the entire postfooter the only way to use these new subfunctions, or is there a way to selectively add/remove them from the existing definitions?

    Posted 9 years ago #
  5. Hi,

    need some help on this.

    I'm thinking about a short code based version.

    Something like:

    $postheader  = '[open_posttitle][posttitle][close_posttitle]';
    $postheader .= '[open_meta]';
    $postheader .= '[authorlink];
    $postheader .= '[sep-entrydate];
    $postheader .= '[entry-date]';
    $postheader .= '[sep-editlink]';
    $postheader .= '[editlink]';
    $postheader .= '[close_meta]';

    For the footer:

    $postfooter  = '[open_utility]';
    $postfooter .= '[postcategory]';
    $postfooter .= '[sep-posttags]';
    $postfooter .= '[posttags]';
    $postfooter .= '[sep-postconnect]';
    $postfooter .= '[postconnect]';
    $postfooter .= '[close_utility]';

    We might need more than just one variable for the postfooter / postheader.

    The variable could be filtered / rearranged. This makes it easier for the most users. And as long as someone understands the use of short codes, it shouldn't be a problem to add additional ones to extend the functionality, or to add additional CSS markup.

    Any thoughts?

    Chris

    Posted 9 years ago #
  6. Sorry for the delay in getting back on this...

    Yes, being able to use shortcodes to assemble custom versions of postheader and postfooter would be easier **as long as** the separators are defined separately too and not included in the individual subfunctions. Then again if that were the case, wouldn't it be almost equally easy to use the new subfunctions?

    Another use example: I want to include the edit link in postheader, but am applying a CSS button style to it and don't need a text "|" separator between the button and whatever text preceded it.

    All that said, I'm assuming that to remove a function, e.g. the comment link, I would still have to redefine all of postfooter. It's just that it would be easier with shortcodes, right?

    Posted 9 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.