Forums

How to remove header navigation from certain pages only (7 posts)

  1. affilamill
    Member
    Posted 1 year ago #

    I want to remove the header navigation from certain pages on my site. I use these pages for landing pages from PPC, and the navigation is a distraction I do not want. Anyone know how to do this? Any help would be appreciated. thanks!!

  2. ClaytonJames
    Member
    Posted 1 year ago #

    Maybe wp_list_pages with conditional tags. See if these are any help.

    http://codex.wordpress.org/wp_list_pages

    http://codex.wordpress.org/Conditional_Tags

  3. chaoskaizer
    Member
    Posted 1 year ago #

    assuming u knew how to edit template I suggest you use WP Conditional Tags like so

    <?php if(!is_page('post_title')): ?>
    <!-- nav menu here -->
    <?php endif; ?>

    refer → http://codex.wordpress.org/Conditional_Tags#A_PAGE_Page

  4. ClaytonJames
    Member
    Posted 1 year ago #

    Take this as an example only, I am not completely sure if it is on (or even near) the mark, but I think you are looking for something like this:

    <?php if is_page('yourpagename') { //if this is page "yourpagename",  exclude pages 1,3,5 and 7 ?>
    <?php $children = wp_list_pages('exclude=1,3,5,7 sort_column=menu_order&depth=1&title_li=');?>
    <?php } else { //show all pages ?>
    <?php $children = wp_list_pages('sort_column=menu_order&depth=1&title_li=');?>
    <?php } ?>

    I'm hoping someone with a sharp eye will correct it if not.

  5. affilamill
    Member
    Posted 1 year ago #

    Thank you for the response, but i have seen this and I think this only allows me to remove certain pages from the sites navigation. What I need to do is remove the entire navigation on certain pages only, but leave it on places like the homepage.

    I tried to modify the "theme" that I created to do this, but when I created a new header file "header1.php" and tried to call it in the theme, it gave me an error. Any ideas?

  6. blogsdna
    Member
    Posted 1 year ago #

    @Affilamill,

    You need put condition before wp_list_pages templat tag for e.g

    <?php if (is_home (wp_list_pages();) ) { } elseif ( is_category() ) {wp_list_pages(); } elseif (is_single() ) {wp_list_pages(); } elseif (is_page() ) { wp_list_pages();} elseif (is_search()) {wp_list_pages(); } ?>

    incase you want per post this sort of modification then you have to go for wordpress loop like

    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <? if (the_ID()=1);wp_list_pages(); ?>

    please keep this in mind having this sort of loop will make your blog slower loading.

  7. blogsdna
    Member
    Posted 1 year ago #

    and you have to have name of header file as header.php if your theme is using template tag <?php get_header(); ?> else use <?php include(TEMPLATEPATH."/header1.php");?>

Topic Closed

This topic has been closed to new replies.

About this Topic