• I’m using woocommerce and Sensei on my website – https://www.NaturesHealing.info. I want the student course page to have a different look – no tall header banner – something more narrow, less cluttered. I also need a left sidebar included.

    I have tried researching how to create a page template but the page.php is not easy to clone in my theme if I understand it properly. I was hoping I could copy it and change the name and modify it’s contents but the code inside this file is only a few lines referencing other files making it more of a challenge. See here:
    <?php get_header(); ?>
    <?php get_template_part(‘loop’); ?>
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>

    I plan to change/update my theme next year but it’s too much to handle right now as I am trying to launch this sensei online course project.

    Can anyone offer some option to create a simple template I can reference through the “Page Attributes – drop down” that I can choose so a few pages associated with the online course has a less complex layout without a busy header/banner.

    This is my first time trying to setup a layout for an online course using woocommerce and sensei so maybe I am going about this all wrong so any and all suggestions are welcomed.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Edit your header.php file and in that file use multiple if statements. If you want to show the same header on all the pages except student course page; then pick up the id of that page and and write it like
    <?php if(is_page(19)) { ?>
    //write your html over here for student course page header
    <?php } ?>
    Don’t need to edit page.php file; simply edit header.php for calling different headers….

    Thread Starter ccarlow

    (@ccarlow)

    I was hoping to find a simple template I can reference through the “Page Attributes – drop down”. I need to effect more than the header at this time now.

    I’ll play around with the code you suggested Mehreen_Arshad – thx.

    Thread Starter ccarlow

    (@ccarlow)

    I’m not understanding the php format <?php if(is_page(19)) { ?>

    How do I write an if else statement based on your format which is working for me but I want to exclude parts of the header if a page id rrelated to my course is being viewed.

    the IF else statement code I found has a different format and I’m not understanding the difference for the “else” statement.

    i.e.
    <?php
    $t = date(“H”);

    if ($t < “20”) {
    echo “Have a good day!”;
    } else {
    echo “Have a good night!”;
    }
    ?>

    Thread Starter ccarlow

    (@ccarlow)

    I think I have a working syntax
    There are different syntax

    <?php if ( expression) : ?>
    <!– info here –>
    <?php else : ?>
    <!– alt info here –>
    <?php endif ?>

    I like this format because the endif statement helps identify the end easily.

    Thread Starter ccarlow

    (@ccarlow)

    I am trying to place php code in my header.php to identify all main pages related to my courses and woocommerce store.

    I have created the below code and each number in the array represents a page ID. This php code works for every page ID except woocommerce “shop” – page id 4528.

    Anyone know why isn’t the page_id being recognized:

    Here’s code:
    <!– My test code –>
    <?php if (is_page( array( 4708, 4534, 4533, 4531, 4530, 4529, 4528 ) ) ) : ?>
    <div>This is a course page</div>
    <?php else : ?>
    <!– do nothing –>
    <?php endif ?>
    <!– my test code to be removed – end –>

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Creating page Template with different header’ is closed to new replies.