ThemeShaper Forums » Thematic

[closed]

Modifying Thematic_header

(3 posts)
  • Started 7 years ago by proto
  • Latest reply from proto
  • This topic is resolved
  1. proto
    Member

    Hello All,

    I am trying to modify the html markup in thematic_header. I want to add classes to the existing markup in the header, such as #branding, #logo-image, #access, etc... Helga gave me some great advice of how to filter widgetised areas on a previous post, but I wondered can I change this HTML markup in the header area?

    I searched thematic for the functions that create the thematic header html markup and found the following in the thematic header-extensions.php folder where I think the markup is created, I've tried copying this to my child theme folder root directory and modifying accordingly but it still didn't work:

    // Functions that hook into thematic_header()
    
                    // Open #branding
                    // In the header div
                    function thematic_brandingopen() { ?>
                            <div id="branding">
                    <?php }
                    add_action('thematic_header','thematic_brandingopen',1);
    
                    // Create the blog title
                    // In the header div
                    function thematic_blogtitle() { ?>
                                    <div id="blog-title"><span><a href="<?php bloginfo('url') ?>/" title="<?php bloginfo('name') ?>" rel="home"><?php bloginfo('name') ?></a></span></div>
                    <?php }
                    add_action('thematic_header','thematic_blogtitle',3);
    
                    // Create the blog description
                    // In the header div
                    function thematic_blogdescription() {
                                    if (is_home() || is_front_page()) { ?>
                                    <h1 id="blog-description"><?php bloginfo('description') ?></h1>
                                    <?php } else { ?>
                                    <div id="blog-description"><?php bloginfo('description') ?></div>
                                    <?php }
                    }
                    add_action('thematic_header','thematic_blogdescription',5);
    
                    // Close #branding
                    // In the header div
                    function thematic_brandingclose() { ?>
                            </div><!--  #branding -->
                    <?php }
                    add_action('thematic_header','thematic_brandingclose',7);
    
                    // Create #access
                    // In the header div
                    function thematic_access() { ?>
                            <div id="access">
                                    <div class="skip-link"><a href="#content" title="<?php _e('Skip navigation to the content', 'thematic'); ?>"><?php _e('Skip to content', 'thematic'); ?></a></div>
                                <?php wp_page_menu('sort_column=menu_order') ?>
                            </div><!-- #access -->
                    <?php }
                    add_action('thematic_header','thematic_access',9);
    
    // End of functions that hook into thematic_header()

    The code I'm using to try and modify the markup was to try and filter the functions that create the html markup in the first place, eg:

    function pixelwoo_change_access_class($content) {
        return str_replace('<div id="access">', '<div id="access" class="grid_6">', $content);
    }
    add_filter('thematic_access','pixelwoo_change_access_class');

    Does anyone know how to do this? I tried simply copying the original header-extensions.php file and putting this in the main directory of my child theme but this did not seem to override and add my modified html markup either? Any suggestions gratefully received! :)

    Posted 7 years ago #
  2. dude, i repeat, you can only use add_filter() to filter a variable where the source code (wp, a plugin, or in this case, Thematic) says APPLY_FILTERS. you can't just add a filter to something made up.

    also, fyi, b/c header-extensions.php isn't a WP template you can't just override it by putting a header-extensions.php in your child theme. you have to use the built in override functions. look in header-extensions.php... there are several instances where the code reads IF the childtheme_override_some_function() exists run that... otherwise run the thematic_some_function().

    if you want to add a class to #access then you have to override the thematic_access() function.

    function childtheme_override_access() { ?>
    
           <div id="access" class="ilovebacon">
    
    	    	<div class="skip-link"><a href="#content" title="<?php _e('Skip navigation to the content', 'thematic'); ?>"><?php _e('Skip to content', 'thematic'); ?></a></div><!-- .skip-link -->
    
    	    	<?php 
    
    	    	if ((function_exists("has_nav_menu")) && (has_nav_menu(apply_filters('thematic_primary_menu_id', 'primary-menu')))) {
    	    		echo  wp_nav_menu(thematic_nav_menu_args());
        		} else {
        			echo  thematic_add_menuclass(wp_page_menu(thematic_page_menu_args()));
        		}
    
    	    	?>
    
    		</div><!-- #access -->
    
    		<?php }
    }
    Posted 7 years ago #
  3. proto
    Member

    Thanks Helga,

    Happy New Year and thanks for your helpful response!

    Much appreciated :)

    Posted 7 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.