Skip Navigation

[Resolved] Change the theme header based on type

The Toolset Community Forum is closed, for technical support questions, please head on to our Toolset Professional Support (for paid clients), with any pre-sale or admin question please contact us here.
This support ticket is created 9 years, 11 months ago. There's a good chance that you are reading advice that it now obsolete.
This is the community support forum for Types plugin, which is part of Toolset. Toolset is a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients and people who registered for Types community support can post in it.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 19:00 10:00 – 19:00 10:00 – 19:00 10:00 – 19:00 10:00 – 19:00 -
- - - - - - -

Supporter timezone: Europe/Madrid (GMT+01:00)

This topic contains 4 replies, has 2 voices.

Last updated by jamesG-3 9 years, 10 months ago.

Assisted by: Caridad.

Author
Posts
#219969

Hi all - I have a site with 4 distinct types at work: a blog, a magazine, a shop and a video section. When someone goes to the video section I would like that to use a different site header. I have tried a few header plugins but none recognize types, they merely distinguish between pages or posts. Any thoughts?

Thanks!

#220039

Dear James,

You will have to edit the header.php file and use conditionals.

<?php if ( get_post_type() == 'magazine' ) : ?>
SHOW MAGAZINE HEADER
<?php elseif ( get_post_type() == 'video' ) : ?>
SHOW VIDEO HEADER
<?php elseif ( get_post_type() == 'shop' ) : ?>
SHOW SHOP HEADER
<?php else: ?>
SHOW BLOG HEADER
<?php endif; ?>

Please let me know if you are satisfied with my answer and if I can help you with any other questions you might have.

Regards,
Caridad

#220136

Thanks for the prompt response. The header is presently drawn from this code:

<?php

	do_action('skeleton_header');


?>

This is the correct header for everything apart from post_type single-tv

How would I go about getting the new image in and having it recognize this with the above code?

(apologies if this is more rudimentary than I am seeing)

#220264

Dear James,

Try replacing that line with the following block of code:

<?php if ( get_post_type() == 'single-tv' ) : ?>

  SHOW YOUR CUSTOM HEADER HERE

<?php else : ?>

  <?php
  do_action('skeleton_header');
  ?>

<?php endif; ?>

Please let me know if you are satisfied with my answer and if I can help you with any other questions you might have.

Regards,
Caridad

#220460

That worked a treat - thanks so much!!

The forum ‘Types Community Support’ is closed to new topics and replies.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.