Active button for home.php
-
Hello.
I have a similar problem to this topic: https://www.ads-software.com/support/topic/264319?replies=10 but it doesn’t give me a solution I can use. So therefore I created a new topic.
Here’s my problem:
I can’t get my “Frontpage” button in my footer to show active when I’m on my frontpage. Instead the button for a category is showing active.I have createad a home.php page that works as my static frontpage (Without choosing static frontpage in the control panel). This home.php shows the recent post in two different categories.
I have two other buttons which only opens posts if is_category.
How to get the buttons to reckognise the frontpage as
<?php echo get_option('home'); ?>
I have figured out that the footer shows the category button active because the last post on home.php is from that particular category. Do not have the problem in my header buttons…
This is how I have coded in the recent posts in my home.php:
<div id="forsideinnhold"> <div class="presse"> <h4>Ferskeste presseoppslag</h4> <ul> <?php //begin the loop, show my recent posts, some of this code will have to be changed to match your theme, ie. the date postion query_posts('cat=3&posts_per_page=6'); if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> <li><a href="<?php the_permalink() ?>" title="Link til <?php the_title(); ?>"><?php the_title(); ?><br /> <span class="date"><?php the_time('j. F Y') ?></span></a></li> <?php endwhile; else: ?> <p><?php _e('Sorry, no posts.'); ?></p> <?php endif; //end the loop, we are done grabbing posts ?> </ul> </div> <div class="artikler"> <h4>Ferskeste fagartikler</h4> <ul> <?php //begin the loop, show my recent posts, some of this code will have to be changed to match your theme, ie. the date postion query_posts('cat=4&posts_per_page=3'); if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> <div class="exe"> <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Les innlegget <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2> <?php the_excerpt(); ?> <div class="time">Lagt ut den <strong><?php the_time('j. F Y') ?></strong> og skrevet av <strong><?php the_author(); ?>.</strong> <br /><?php edit_post_link('Edit', '', ' | '); ?> <?php comments_popup_link('Ingen kommentar »', '1 kommentar »', '% kommentarer »'); ?></div></div> <?php endwhile; else: ?> <p><?php _e('Sorry, no posts.'); ?></p> <?php endif; //end the loop, we are done grabbing posts ?> </ul> </div> </div>
And my footer buttons is coded like this:
<div class="footnav"> <ol> <li id="forside"><a <?php if ( is_front_page() ) { ?> class="active"<?php } ?> href="<?php echo get_option('home'); ?>/index.php" title="Forsiden"></a></li> <li id="fag"><a <?php if ( is_category('fagartikler') ) { ?> class="active"<?php } ?> href="<?php echo get_option('home'); ?>/fagartikler" title="Fagartikler"></a></li> <li id="presse"><a <?php if ( is_category('presse') ) { ?> class="active"<?php } ?> href="<?php echo get_option('home'); ?>/presse" title="Presseomtale"></a></li> <li id="analyse"><a <?php if ( is_page(2) ) { ?> class="active"<?php } ?> href="<?php echo get_option('home'); ?>/?page_id=2" title="Bestill en analyse"></a></li> <li id="om"><a <?php if ( is_page(10) ) { ?> class="active"<?php } ?> href="<?php echo get_option('home'); ?>/?page_id=10" title="Om Sosioraster"></a></li> </ol> </div>
Anyone have the time to help me?
- The topic ‘Active button for home.php’ is closed to new replies.