Strict Standards: Redefining already defined constructor for class bbdb in /home/themes/public_html/forums/bb-includes/db-mysql.php on line 12

Strict Standards: Declaration of BB_Walker_Blank::start_lvl() should be compatible with BB_Walker::start_lvl($output) in /home/themes/public_html/forums/bb-includes/classes.php on line 1127

Strict Standards: Declaration of BB_Walker_Blank::end_lvl() should be compatible with BB_Walker::end_lvl($output) in /home/themes/public_html/forums/bb-includes/classes.php on line 1127

Strict Standards: Declaration of BB_Walker_Blank::start_el() should be compatible with BB_Walker::start_el($output) in /home/themes/public_html/forums/bb-includes/classes.php on line 1127

Strict Standards: Declaration of BB_Walker_Blank::end_el() should be compatible with BB_Walker::end_el($output) in /home/themes/public_html/forums/bb-includes/classes.php on line 1127
Hooks, Filters, Actions, Apply, Add « ThemeShaper Forums

ThemeShaper Forums » Thematic

[closed]

Hooks, Filters, Actions, Apply, Add

(5 posts)
  • Started 4 years ago by DataGnostics
  • Latest reply from DataGnostics
  • This topic is resolved

  1. Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/themes/public_html/forums/bb-includes/kses.php on line 440

    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/themes/public_html/forums/bb-includes/kses.php on line 510

    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/themes/public_html/forums/bb-includes/kses.php on line 512


    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/themes/public_html/forums/bb-includes/kses.php on line 440

    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/themes/public_html/forums/bb-includes/kses.php on line 510

    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/themes/public_html/forums/bb-includes/kses.php on line 512
    DataGnostics

    Member

    I do not have a clear picture in my mind of which kind of function-verb to use for a customization. This is what I mean:

    I have, in my theme's function.php:

    function mytheme_thing () {
        something that will be different for my theme;
       }

    Assume that there's a function thematic_thing(). I don't have a good sense of when to use apply_filters, add_filter, add_action, or what, to attach mytheme_thing to thematic_thing. Sometimes I want mytheme_thing to replace all of thematic_thing, sometimes I want it to be in addition to themetic_thing, sometimes I want to replace part of thematic_thing.

    Right now I'm specifically trying to add a javascript onclick function to h2 class="entry-title" on certain pages, but while I can replace thematic_postheader_posttitle, I want to merely *add* something, instead. I need a better cookbook.

    Posted 4 years ago #

  2. Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/themes/public_html/forums/bb-includes/kses.php on line 440

    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/themes/public_html/forums/bb-includes/kses.php on line 510

    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/themes/public_html/forums/bb-includes/kses.php on line 512


    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/themes/public_html/forums/bb-includes/kses.php on line 440

    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/themes/public_html/forums/bb-includes/kses.php on line 510

    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/themes/public_html/forums/bb-includes/kses.php on line 512
    helgatheviking

    Moderator

    check out the thematic guide for a decent explanation of hooks and filters.

    http://themeshaper.com/thematic/guide/

    since the writing of the guide thematic has evolved to also include override functions. following your example of a function thematic_thing(). you would only need to define a function named childtheme_override_thing() in your functions.php and thematic will automagically use it in place of the original.

    adding, removing and filtering are still the same as defined in the guide. I like to think of filtering any time the original function returns a variable.... such as $content or $something. Maybe I only want to add "bacon" in front of what is already there. I'd use a filter.

    function add_bacon($content){
      $content .= "bacon";
      return $content;
    }
    add_filter('function_to_be_filtered','add_bacon');

    adding and removing is more like putting coats on pegs. If i want to add a coat (function) to a specific peg then i'd use add_action with the appropriate hook name

    add_action('thematic_hook_name','my_function_name',option_position_number);
    Posted 4 years ago #

  3. Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/themes/public_html/forums/bb-includes/kses.php on line 440

    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/themes/public_html/forums/bb-includes/kses.php on line 510

    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/themes/public_html/forums/bb-includes/kses.php on line 512


    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/themes/public_html/forums/bb-includes/kses.php on line 440

    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/themes/public_html/forums/bb-includes/kses.php on line 510

    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/themes/public_html/forums/bb-includes/kses.php on line 512
    DataGnostics

    Member

    Still not clear to me, so I shall be more specific.

    In thematic content-extensions there is the following code:

    function thematic_postheader_posttitle() {
    
    	    if (is_single() || is_page()) {
    	        $posttitle = '<h1 class="entry-title">' . get_the_title() . "</h1>\n";
    	    } elseif (is_404()) {
    	        $posttitle = '<h1 class="entry-title">' . __('Not Found', 'thematic') . "</h1>\n";
    	    } else {
    	        $posttitle = '<h2 class="entry-title"><a href="';

    I want to basically change the last two lines here, to be:

    } else {
    	        $posttitle = '<h2 class="entry-title"';
                    if ([certain conditions are met]){
    			$posttitle .= ' [onclick my_custom_function]';
    		} $posttitle .= '"><a href="';

    but I don't know how to put it in there in mid-thematic-function.

    Posted 4 years ago #

  4. Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/themes/public_html/forums/bb-includes/kses.php on line 440

    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/themes/public_html/forums/bb-includes/kses.php on line 510

    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/themes/public_html/forums/bb-includes/kses.php on line 512


    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/themes/public_html/forums/bb-includes/kses.php on line 440

    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/themes/public_html/forums/bb-includes/kses.php on line 510

    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/themes/public_html/forums/bb-includes/kses.php on line 512
    helgatheviking

    Moderator

    well ask a vague question, get a vague answer. ;)

    what you are aiming to do is best solved with a filter, since you don't want to change everything. i didn't test this, but try:

    my_postheader_posttitle($posttitle) {
    
    	if ([certain conditions are met]){
    			$posttitle .= ' [onclick my_custom_function]';
            }
      return $posttitle;
    }
    add_filter('thematic_postheader_posttitle','my_postheader_posttitle');

    i'm not sure whether it should be

    $posttitle .= [functions];

    or

    $posttitle = [functions];

    b/c i still don't know exactly what you are trying to do. just be aware that .= means it will tack [functions] onto the end of what already exists for $posttitle... whereas a straight = means you are wiping out $posttitle in favor of [functions]

    }

    Posted 4 years ago #

  5. Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/themes/public_html/forums/bb-includes/kses.php on line 440

    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/themes/public_html/forums/bb-includes/kses.php on line 510

    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/themes/public_html/forums/bb-includes/kses.php on line 512


    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/themes/public_html/forums/bb-includes/kses.php on line 440

    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/themes/public_html/forums/bb-includes/kses.php on line 510

    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/themes/public_html/forums/bb-includes/kses.php on line 512
    DataGnostics

    Member

    I ended up writing a childtheme_override_postheader_posttitle, because either my function was replacing thematic's posttitle, or it was being tacked on the end, and I wanted it in the middle.

    Posted 4 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.


Strict Standards: call_user_func_array() expects parameter 1 to be a valid callback, non-static method GA_Filter::spool_analytics() should not be called statically in /home/themes/public_html/forums/bb-includes/wp-functions.php on line 586

Strict Standards: Non-static method GA_Filter::spool_this() should not be called statically in /home/themes/public_html/forums/my-plugins/googleanalytics.php on line 183