Check if it's the first post
-
Hi
I’m getting crazy with this one. I have my index redirecting to the single.php because I want to show single posts right in the website entrance. I dont know if this is in fact the best way to do this, but as it works I’m using this method.Index.php
<?php require('./wp-blog-header.php'); if (have_posts()) : the_post(); header("location: ".get_permalink()); exit; endif; ?>
Single.php
<?php get_header(); ?> <div id="bcshadow"></div> <section id="ballcontent" role="main"> <div id="bpostnavigation"> <?php get_template_part( 'nav', 'below-single' ); ?> </div> <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> <?php if ( is_front_page() ) { ?> <div class="bcontent"> <?php get_template_part( 'entry' ); ?> </div> <div class="mynewsonlyinfisrtpost">NEWS</div> <?php } else { ?> <div class="bcontent"> <?php get_template_part( 'entry' ); ?> </div> <?php } ?> <?php endwhile; endif;?> </section> <?php get_footer(); ?>
Thank you in advanced for your help.
AMP.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Check if it's the first post’ is closed to new replies.