ThemeShaper Forums » Thematic

[closed]

postfooter, unhooking? unloading? functions or filters or hooks?

(4 posts)
  • Started 14 years ago by EmilR
  • Latest reply from dancer
  • This topic is not resolved
  1. EmilR
    Member

    In the Thematics content-extensions.php you have the following code for creating the information in the Post Footer.

    // Information in Post Footer
    function thematic_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();
            } else {
                $postfooter = '<div class="entry-utility">' . thematic_postfooter_postcategory() . thematic_postfooter_posttags() . thematic_postfooter_postcomments();
            }
            $postfooter .= "</div><!-- .entry-utility -->\n";
        }
    
        // Put it on the screen
        echo apply_filters('thematic_postfooter',$postfooter); // Filter to override default post footer
    } // end thematic_postfooter

    As you can see this function decides that the posteditlink, postcategory, posttags, postconnect and postcomments should be included in the postfooter.

    Now in my child theme I want to unload thematic_postfooter_postcategory, posttags and postconnect and load my own function my_postfooter_postshare.

    What is the easiest way to do this?

    I have tried the unhook_thematic_functions function but with no luck. It works when unhooking the access (menu) in header (hook) but not when trying to unhook posttags in postfooter. Maybe because the postfooter is not a hook? Or because posttags has add_filter and not add_action at the end? I am confused, please explain to me what I can unload/unhook using the remove (init) function.

    Basically what I have done now is filter the entire postfooter function and adding my own postfooter which are calling for my own functions (such as my_postfooter_postshare). Is this really the ideal solution?

    I would like to just unload the following . . . . load the following . . . . in the thematic_postfooter ... Please give me a better idea how to work this.

    Posted 14 years ago #
  2. dancer
    Member

    I have a similar question for a similar need. I would like to change what is in the post headers and post footers. While one can do this using the filter, it seems like that would cause unnecessary processing as one has to basically re-parse and re-put together what was constructed in the function before.

    So I tried to see if PHP functions could be overridden, but it doesn't seem so unless the code is object-oriented.

    Yes, thematic_postfooter is a filter, not a hook.

    Posted 14 years ago #
  3. patrick
    Member

    Hello,

    try this and let me know how it goes :

    // Postfooter mod
    function yourname_postfooter() {
    
        your code
    
    }
    add_filter('thematic_postfooter','yourname_postfooter');

    P.

    Posted 14 years ago #
  4. dancer
    Member

    Well, that works but I think we were both asking is there a more optimal way of doing this instead of having this sort of double processing and unnecessary code running before our custom function is called?

    Posted 14 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.