Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

josh5723 on "Load New Header File On Certain Pages"

$
0
0

I've searched a bunch on this issue and have found many people giving different advice. I will only need 2 different header files for my site, the original and the new one I've since created (titled header-second.php).

I'll want header-2 to appear on multiple pages, identified by their Page ID. How do I accomplish this the easiest? An if tag in the index.php file?

This is included on the multiple headers page:

<?php
if ( is_home() ) :
	get_header( 'home' );
elseif ( is_404() ) :
	get_header( '404' );
else :
	get_header();
endif;
?>

How do I alter this for specific page IDs? I've tried adding this to index.php, but it changed nothing and still loaded the original header.php.

<?php
if ( is_page(417) ) :
	get_header( 'second' );
else :
	get_header();
endif;
?>

Do I need to add this code to all .php files where get_header is present? What am I doing wrong?

Thanks a lot!


Viewing all articles
Browse latest Browse all 8245

Trending Articles