Modify index.php to show a static post and recent posts from a category
-
Hi I’m new to WordPress and am currently trying to modify this theme.
It’s been designed to show only ONE post per view, and I am trying to get it to show a static post (which acts as an introduction), followed by posts from the category ‘thoughts.’
This is the index.php code I’m mucking around with:
<?php get_header(); ?> <?php $temp = $wp_query; $wp_query= null; $wp_query = new WP_Query(); $wp_query->query('showposts=1'.'&paged='.$paged); ?> <?php while ($wp_query->have_posts()) : $wp_query->the_post(); ?> <!-- ><span class="date"><?php the_time('F j Y') ?></span> --> <!-- >This article was written on this date, with the mathematical number of <?php comments_number('0', '1', '%'); ?> contributions. --> <h1><a href="<?php the_permalink(); ?>" title="Comment: <?php the_permalink(); ?>"><?php the_title(); ?></a></h1> <!-- ><h2><?php the_excerpt(); ?></h2> --> </div> <div id="navigate"> <?php posts_nav_link('','','Prev') ?><span class="big"> <strong>/</strong> </span><?php posts_nav_link('','Next','') ?> </div> <div id="content_hold"> <div id="content"> <?php the_content('...'); ?> <?php endwhile; ?> <?php $wp_query = null; $wp_query = $temp;?> </div> <?php get_sidebar(); ?> <?php get_footer(); ?>
I looked around on WordPress and tried:
$wp_query->query('category_name=thoughts'.'showposts=99'.'&paged='.$paged);
Which didn’t work, I assume the syntax is wrong or I can’t parse ‘category_name=thoughts’ in this case, I really don’t know.
Can someone help me out please?
Thanks.
- The topic ‘Modify index.php to show a static post and recent posts from a category’ is closed to new replies.