I’ve a created wordpress membership site using wishlist member plugin. But I want to have different header.php based on different logins.

Eg: Users are: Print, Web and Free

  1. When Free user logs in – I want header1.php to load and stay till he logs out
  2. When Print user logs in – I want header2.php to load and stay till he logs out
  3. When Web user logs in – I want header3.php to load and stay till he logs out

If nobody has logged in the default header.php stays.

Please assist on how to do this.

Regards, Raghav.

  • Could you show us some code that you wrote, and tell us what's not working with it?
    – Lea Cohen
    Jan 17, 2013 at 11:09

1 Answer 1


You can achieve this by getting the Membership Level of the current user, and making a conditional based on this. As I do not have a license for wishlist member, this is untested.

I suppose $member_id to be the same value as the WordPress ID of the logged in User.

    global $current_user;
    $member_id = $current_user->ID;
    $api = new wlmapiclass('http://yourblog.com/', 'yourAPIKey');
    $api->return_format = 'php'; // <- value can also be xml or json
    $membership = $api->get( /members/{$member_id} );
    $membership = unserialize( $membership );
    print_r( $membership ); // see in which value the actual ID or slug of the membership is stored, I cannot reproduce that..

As TomJNowell pointed out, it would be even better to change the include to

get_header( $membershiplevel );

So you are good to go for future Membership levels.

  • 2
    why not just do get_header($membershiplevel); ? Then you'd have header.php header-Free.php header-Print.php and header-Web.php, and it'd be futureproofed if a 4th member type ever came along
    – Tom J Nowell
    Jan 17, 2013 at 10:23
  • @TomJNowell of course, silly me, did not think of that ;)
    – fischi
    Jan 17, 2013 at 10:29
  • Where actually this script will go? in the themes function.php?
    – Raghav
    Jan 17, 2013 at 11:01
  • This script goes to this place where you would normally include your header file, so usually in the page.php or the single.php. You can also make it a function.
    – fischi
    Jan 17, 2013 at 11:03
  • 2
    This is a question that is purely related to the wishlist member plugin, so you should ask there for support in this matter. The WordPress-Part, as above, should work this way.
    – fischi
    Jan 17, 2013 at 11:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.