Forums

[resolved] calling a different header if a user is logged in (3 posts)

  1. woodenpier
    Member
    Posted 3 years ago #

    Hi,

    I am trying to call a new header file if a user is logged in. My question is probably more about php than WordPress per-say, but I am already a member here and thought it would be faster to ask here.

    I know that I can call text strings using echo with the <?php if ( is_user_logged_in() ) { ... } ?> function

    But what should the code look like if I wanted to call a specific header file from the page file using the <?php get_header() ?>

    Cheers!

    -Zak

  2. MichaelH
    Member
    Posted 3 years ago #

    Something like:

    <?php
    if ( is_user_logged_in() ) {
      get_header('loggedin'); // will include header-loggedin.php
    } else {
      get_header('notloggedin'); // will include header-notloggedin.php
    }
    ?>
  3. woodenpier
    Member
    Posted 3 years ago #

    Thanks heaps.

    I am a designer and know XHTML and CSS up and down. I know just enough PhP to get by with most WP templating (thanks to the codex!) but sometimes something simple get's in the way.

    Cheers,

    -Zak

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.