Best Practice?
-
Hello,
I’m not new to web design; just new to WordPress. I’ve spent days trying to figure out how to post one post from a category on the static page I use as the home page. I found a hunk of code that seems to do the trick:
<div class="feature-box"> <!--===== THE LOOP =====--> <?php $the_query = new WP_Query( 'category_name=next-concert' ); ?> <?php if ( $the_query->have_posts() ) : ?> <!-- the loop --> <div class="concert-info"> <?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?> <h1> <?php the_title(); ?> </h1> <p> <?php the_content(); ?> </p> <?php endwhile; ?> <!--===== END OF CONCERT INFO =====--> <!-- end of the loop --> </div>
I’ve auditioned many themes and even written my own but smpl-skeleton seems to have what I need all in one place. So, the secret to gaining my happiness seems to be gaining an understanding of the process of assigning a custom loop file (loop-home-page.php) to the home page. However, I don’t seem to be able to wrap my head around the flow of the template. Which file is actually the home page? Do I need to alter the function.php file to point to the custom loop page or is that taken care of in a different manner? Or is it possible to change the above code with a condition that the post only happens on the home page?
Thanks for your help. Links to references would be awesome – there seems to be a lot of very old info out there and I’ve spent days going through it.
- The topic ‘Best Practice?’ is closed to new replies.