ThemeShaper Forums » Thematic

[closed]

Not clear how childtheme_override works

(14 posts)
  • Started 3 years ago by mirko77
  • Latest reply from helgatheviking
  • This topic is not resolved
  1. I want to add a couple of <div> containers in my child theme header, inside #branding.

    If I modify the function thematic_brandingopen() directly in header-extension.php it works flawlessly:

    function thematic_brandingopen() {
     echo "<div id=\"branding\"><div id='logo-container'></div><div id='social-links'></div>\n";
    }

    but if I create a childtheme_override_brandingopen() my whole #branding div container disappears...

    function childtheme_override_brandingopen(){
    echo "<div id=\"branding\"><div id='logo-container'></div><div id='social-links'>      </div>\n";
    }

    I do not know why it does not work...

    Posted 3 years ago #
  2. The override functions are meant so you don't have to modify the original thematic source files.

    Create a new child theme (there are guides for how to do this online). In your child them folder, create "functions.php". Within functions.php, paste your code

    function childtheme_override_brandingopen(){
       echo "<div id=\"branding\"><div id='logo-container'></div><div id='social-links'></div>\n";
    }

    Now your child theme will automatically use this function instead of thematic's default.

    Posted 3 years ago #
  3. That is exactly what I did.
    I created my child theme with its own function.php, but my override function does not work.

    I have other custom functions in my own function.php and they all work

    Posted 3 years ago #
  4. antesark
    Member

    Try..

    function childtheme_override_brandingopen() { ?>
    <div id="branding"><div id="logo-container"></div><div id="social-links"></div>
    <?php }

    function childtheme_override_brandingclose() { ?>
    </div><!-- #branding -->
    <?php }

    And remember not to use add_action.

    Posted 3 years ago #
  5. actually if you take a look at the header-extensions.php file you will see exactly what happens w/ the override

    // Open #branding
    	// In the header div
    	if (function_exists('childtheme_override_brandingopen'))  {
    	    function thematic_brandingopen() {
    	    	childtheme_override_brandingopen();
    	    }
    	} else {
    		function thematic_brandingopen() {
    			echo "<div id=\"branding\">\n";
    		}
    	    add_action('thematic_header','thematic_brandingopen',1);
    	}

    look carefully, if childtheme_override_brandingopen exists then the action is NOT added to the thematic_header, hence you see nothing.

    i dont know that i agree w/ this behavior 100% but that's how it is. you need to add childtheme_override_brandingopen to the desired hook. try:

    function childtheme_override_brandingopen(){
    echo "<div id='branding'><div id='logo-container'></div><div id='social-links'>      </div>\n";
    }
    add_action('thematic_header','childtheme_override_brandingopen',1);
    Posted 3 years ago #
  6. Hi,

    I'll check this later today. Normally the override functions should work without add_action. Unfortunately I had the add_action call inside the if-clause. We fixed a couple of these bugs in the latest SVN copies, but I'm not sure if we fixed this one.

    Chris

    Posted 3 years ago #
  7. Ok .. this one is fixed. Grab the latest SVN copy and remove the add_action call.

    Chris

    Posted 3 years ago #
  8. thanks chris!

    Posted 3 years ago #
  9. Oh yes...I overlooked that if statement! Thank you very much!

    Posted 3 years ago #
  10. kirkroberts
    Member

    I just recently downloaded Thematic and it seems this issue is not resolved in the package downloaded from themeshaper.com?
    I see how to fix it but don't want to overwrite core files.
    Not on the SVN train yet... sigh.

    Posted 3 years ago #
  11. kirkroberts
    Member

    Sweet, thanks! I'll check those out.

    Posted 3 years ago #
  12. Teenage
    Member

    Hi,

    The official code (0.9.7.7) still get this bug.

    I stumbled onto this page after looking for information about "childtheme_override_**" that still doesn't existe : http://themeshaper.com/thematic/guide/?s=override&searchsubmit=Find

    Please add the missing "add_action('thematic_header','thematic_***',X);" lines to the next release and update the documentation.

    Posted 3 years ago #
  13. not sure what bug you are seeing?

    0.9.7.7 might be official in the WP repo, but the latest version of Thematic is 0.9.8 which fixed a lot of bugs w/ the overrides

    http://developing.thematic4you.com/thematic-development-release/

    Posted 3 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.