Forums

How Can I Remove My Nav From My Frontpage? (3 posts)

  1. thepterodactyl
    Member
    Posted 2 years ago #

    Im using the K2 template and trying to remove my navigation on my homepage but keep it on the subsequent pages. Can anybody give me an idea or the code to do something like this? Would it be possible to use a custom field to say that if the page is "home" then don't show the navigation?

  2. Michael Bishop
    Forum Concierge
    Posted 2 years ago #

    You could wrap the menu code in a Conditional Tag in your header template to exclude it on the homepage.

    Something to the effect of

    <?php if (!is_front_page) {
      // nav code
     } ?>
  3. thepterodactyl
    Member
    Posted 2 years ago #

    Will it work if I place to the conditional around the following? Won't that break it? Im not a PHP code person so Im clueless what to write...Can anybody help?

    <?php if (is_single()) { ?>
    
    <div class="navigation">
    <?php previous_post_link('<div class="left"><span>&laquo;</span> %link</div>') ?>
    <?php next_post_link('<div class="right">%link <span>&raquo;</span></div>') ?>
    <div class="clear"></div></div>
    
    	<?php } else { ?>
    
    	<div class="navigation">
    <?php $_SERVER['REQUEST_URI']  = preg_replace("/(.*?).php(.*?)&(.*?)&(.*?)&_=/","$2$3",$_SERVER['REQUEST_URI']); ?>
    <div class="left"><?php next_posts_link('<span>&laquo;</span> '.__('Older Entries','k2_domain').''); ?></div>
    <div class="right"><?php previous_posts_link(''.__('Newer Entries','k2_domain').' <span>&raquo;</span>'); ?></div>
    <div class="clear"></div>
    	</div>
    
    	<?php } ?>

Topic Closed

This topic has been closed to new replies.

About this Topic