• Resolved ronchicago

    (@ronchicago)


    I made a new template and wish to modify ( simplify )the header for this series of template(s). i modified the code in header.php and made another file header2.php.

    then within the template i called get header2() and got an error message = call to undefined functions. i knew this was too simple and the good news, i guess, i predicted this error message. can anyone point me in right direction or is this way too theme specific?

Viewing 6 replies - 1 through 6 (of 6 total)
  • FYI get_header function only load “header.php”. You can try the below code to load your custom header template.

    <?php // add inside functions.php
    function get_template_header($filename='header'){
    
     $file = TEMPLATEPATH.DIRECTORY_SEPARATOR.$filename.'.php';
    
     if ( file_exists( $file ) ){
         if (has_filter('get_header')) do_action('get_header');
         load_template( $file );
     } else {
         get_header();
     }
    }
    ?>

    usage

    <?php get_template_header('header2'); // get header2.php ?>

    Thread Starter ronchicago

    (@ronchicago)

    hello chaoskaizer. thank you.

    i dropped your code into functions.php and then replace my “get header” code with your usage code into my new template. did not work… i think i did it right.

    Thread Starter ronchicago

    (@ronchicago)

    i tried replacing this…

    <?php get_header(); ?>

    with this…

    <?php include (TEMPLATEPATH . ‘header2.php’); ?>

    Thread Starter ronchicago

    (@ronchicago)

    here is the fix!

    chaoskaizer, thank you again. the code above was provided by the theme developer. i just noticed that the ” / ” was missing…

    <?php include (TEMPLATEPATH . ‘/header2.php’); ?>

    Thread Starter ronchicago

    (@ronchicago)

    new challenge on header2.php…

    i wish to simplify a nav bar that has 10 category titles on it and wish to display only four.

    the existing code =
    wp_list_categories('title_li='); ?>

    i tried this =
    <?php wp_list_categories('title_li=' . 'exclude=4,27,32,33,82,147'); ?> <!-- 10/12/08 -->

    got an error = Parse error: syntax error, unexpected

    Thread Starter ronchicago

    (@ronchicago)

    this works!

    <?php wp_list_categories(‘title_li=&exclude=27,32,33,144,147’); ?> <!– 11/15/08 –>

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Modified header’ is closed to new replies.