ThemeShaper Forums » Thematic

[closed]

add a div to the header

(7 posts)
  • Started 7 years ago by astima
  • Latest reply from middlesister
  • This topic is not resolved
  1. astima
    Member

    I would like to write a function that would put a div around #branding and #access divs. My problem is I don't know what to put in my div entitled inner_header so that the #branding and #access divs are place inside. I want to create a inner header div so that I can center it on the page. I was using the position absolute attribute but it would display differently on different screens in different browsers. So I thought I would try this.

    <?php
    function inner_header () { ?>
    
    <div id="inner_header">
    
    </div>
    
    <?php
    
    }
    
    add_action('thematic_header', 'inner_header',1);
    
    ?>
    Posted 7 years ago #
  2. sowingseeds
    Member

    You could add the division above the current header and close it below thus:
    function inner_header(){
    ?>
    <div id="inner_header">
    <?php
    }
    add_action('thematic_aboveheader','inner_header');

    function end_inner_heading(){
    ?>
    </div>
    <?php
    }
    add_action('thematic_belowheader','end_inner_header');

    Posted 7 years ago #
  3. astima
    Member

    Thank you very much. I am using the gallery theme (a child theme of thematic), so I am assuming this goes in the thematic functions.php and I not in the gallery functions.php.

    Posted 7 years ago #
  4. astima
    Member

    I'm doing something wrong because the div is not showing up.Here's my code:

    <?php
    
        // Creating the doctype
        thematic_create_doctype();
        echo " ";
        language_attributes();
        echo ">\n";
    
        // Creating the head profile
        thematic_head_profile();
    
        // Creating the doc title
        thematic_doctitle();
    
        // Creating the content type
        thematic_create_contenttype();
    
        // Creating the description
        thematic_show_description();
    
        // Creating the robots tags
        thematic_show_robots();
    
        // Creating the canonical URL
        thematic_canonical_url();
    
        // Loading the stylesheet
        thematic_create_stylesheet();
    
    	if (THEMATIC_COMPATIBLE_FEEDLINKS) {
        	// Creating the internal RSS links
        	thematic_show_rss();
    
        	// Creating the comments RSS links
        	thematic_show_commentsrss();
       	}
    
        // Creating the pingback adress
        thematic_show_pingback();
    
        // Enables comment threading
        thematic_show_commentreply();
    
        // Calling WordPress' header action hook
        wp_head();
    
    ?>
    
    </head>
    
    <?php 
    
    thematic_body();
    
    // action hook for placing content before opening #wrapper
    thematic_before(); 
    
    if (apply_filters('thematic_open_wrapper', true)) {
    	echo '<div id="wrapper" class="hfeed">';
    }
    
        // action hook for placing content above the theme header
        thematic_aboveheader() ;
        function inner_header(){
    ?>
    <div id="innerheader">
    <?php
    }
    add_action('thematic_aboveheader','inner_header',1);
    
        ?>   
    
        <div id="header">
    
            <?php 
    
            // action hook creating the theme header
            thematic_header();
    
            ?>
    
    	</div><!-- #header-->
        <?php
    
        // action hook for placing content below the theme header
        thematic_belowheader();
    function end_inner_heading(){
    ?>
    </div>
    <?php
    }
    add_action('thematic_belowheader','end_inner_header',9); 
    
        ?>   
    
        <div id="main">
    Posted 7 years ago #
  5. sowingseeds
    Member

    The functions go into the child theme. With child themes the great value is the original parent theme (thematic) is left untouched.

    Also you do not need the '1' or the '9' after the 'aboveheader' / 'belowheader' function.

    However, another issue is it seems you have added the code to the header.php file of thematic.

    You need to remove the lines you have added:
    function inner_header(){.....
    add_action('thematic_aboveheader','inner_header',1);
    and
    function end_inner_heading(){....
    add_action('thematic_belowheader','end_inner_header',9);

    Add those to the childtheme functions file.

    Posted 7 years ago #
  6. astima
    Member

    I am almost there. I can see the site, but I am now getting an error message:

    Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'end_inner_header' was given in /home2/stimades/public_html/ctc/wp-includes/plugin.php on line 395

    The div is enclosing more than just the header. I think I did something wrong with the end_inner_header. I don't know if it would help if you saw the site.
    http://www.stimadesigns.com/ctc/?cat=8

    Posted 7 years ago #
  7. middlesister
    Member

    I think it is just a typo. The name of the function and the add_action call need to match:

    function inner_header(){
    ?>
    <div id="inner_header">
    <?php
    }
    add_action('thematic_aboveheader','inner_header');
    
    function end_inner_header(){
    ?>
    </div>
    <?php
    }
    add_action('thematic_belowheader','end_inner_header');
    Posted 7 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.