ThemeShaper Forums » Thematic

Back from vacation with a teaser

(1 post)
  • Started 4 years ago by Chris
  • This topic is not a support question
  1. Hi,

    finally I'm back from vacation .. I worked the whole morning to finalize the new functionality that creates a widget area.

    Still need some more time to write the documentation .. so here's a teaser for the major question "How to add a widget area to your header?":

    The new code for your functions.php:

    // How to add a widgetized area to the header
    // running Thematic 0.9.6-alpha-003 with 2c-r-fixed style
    
    // First of all we create the widgetized area called 'Header Aside'
    function my_widget_areas() {
    	thematic_create_widget_area('Header Aside', thematic_before_widget(), thematic_after_widget(), thematic_before_title(), thematic_after_title(), 'thematic_header','thematic_standard_widget_area', 8);
    }
    add_action('init', 'my_widget_areas');
    
    // Now we need to set $hook to 'header-aside' in addition this will change the CSS markup to the ID 'header-aside'
    // Please note that thematic_process_hook() will remove a trailing 'widget_area_' and change '_' to '-'
    function my_hook($hook) {
    	if ($hook == 'thematic-header') {
    		return 'header-aside';
    	}
    	return $hook;
    }
    add_filter('thematic_process_hook', 'my_hook');
    
    // The rest is the styling part where we add some additional CSS markup.
    
    // First we remove the thematic_brandingopen() .. we're going to make one addition for this one.
    // And we remove thematic_access() .. will be added later unchanged with a priority of 10.
    function remove_branding() {
    		remove_action('thematic_header','thematic_brandingopen',1);
    		remove_action('thematic_header','thematic_access',9);
    }
    add_action('init', 'remove_branding');
    
    // We wrap #branding and #header-aside with #header-box
    function childtheme_brandingopen() { ?>
    	<div id="header_box">
        	<div id="branding">
    <?php }
    add_action('thematic_header','childtheme_brandingopen',1);
    
    // Now we need to close #header-box
    function header_box_close() { ?>
    	</div>
    <?php }
    add_action('thematic_header', 'header_box_close', 9);
    
    // And we add the unchanged thematic_access() with the new priority 10
    add_action('thematic_header','thematic_access', 10);

    .. and the changes for the style.css:

    #header_box {
    	clear: both;
    	margin: 0 auto;
    	overflow: hidden;
    	position: relative;
    	width: 960px;
    }
    
    #branding {
      float: left;
      width: 620px;
    }
    
    /* Moves the new widgetized area to the right and levels it with #branding */
    #header-aside {
      float: right;
      width: 300px;
      padding: 88px 0 44px;
    }
    
    /* This will clear the floats and keeps the access bottom line
    from jumping into the air */
    #access {
      clear: both;
    }

    Don't try this with your current version of Thematic or a current SVN copy .. stay tuned for the announcement ;)

    Chris

    Posted 4 years ago #

RSS feed for this topic

Reply

You must log in to post.