Jump to content

Make code display specific number of titles


phpchick

Recommended Posts

<ul> <!-- List the rest of the articles found in the category -->
		<?php else : ?> 
			<li class="otherrecentmain"><span class="title"><a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></span> <span class="meta"></span>
			</li>
		<?php endif; ?>
		<?php endwhile; ?> <!-- END -->
		</ul>

 

 

For some reason, its stuck on displaying 9 articles but I want to be able to control how many I want. I may want to choose 17 or whatever etc, not sure how to add it into the php.

Link to comment
Share on other sites

<?php get_header(); ?>
<div id="content" class="container">
	<div id="front" class="column_main">
		<div class="category_header">
			<?php is_tag(); ?>
			<?php if (have_posts()) : ?>
		 	<?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?>
			<?php /* If this is a category archive */ if (is_category()) { ?>
			<h1><?php single_cat_title(); ?> News</h1>
				<?php /* If this is a tag archive */ } elseif( is_tag() ) { ?>
			<h1>Posts Tagged &#8216;<?php single_tag_title(); ?>&#8217;</h1>
				<?php /* If this is a daily archive */ } elseif (is_day()) { ?>
			<h1><?php the_time('F jS, Y'); ?></h1>
				<?php /* If this is a monthly archive */ } elseif (is_month()) { ?>
			<h1><?php the_time('F, Y'); ?></h1>
			<?php /* If this is a yearly archive */ } elseif (is_year()) { ?>
			<h1><?php the_time('Y'); ?></h1>
			<?php /* If this is an author archive */ } elseif (is_author()) { ?>
			<h1>Author Archive</h1>
				<?php /* If this is a paged archive */ } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { ?>
			<h1><?php bloginfo('name'); ?> Archives</h1>
				<?php } ?>
		</div>
		<?php $count = 0; ?>
		<?php while (have_posts()) : the_post(); ?>
		<?php $count++; ?>
		<?php if ($count == 1) : ?> <!-- The 1st post, displayed as featured from each category with the black background by default -->
		<div id="featured">
			<h2><?php the_category(', '); ?></h2>
			<h1><a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h1>
			<br />
			<?php the_content('Continue...'); ?>
			<div class="clear"></div>
		</div><!-- END -->

<h2>Latest <?php single_cat_title(); ?> News</h2>



<ul> <!-- List the rest of the articles found in the category -->
		<?php else : ?> 
			<li class="otherrecentmain"><span class="title"><a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></span> <span class="meta"></span>
			</li>
		<?php endif; ?>
		<?php endwhile; ?> <!-- END -->
		</ul>
		<?php else : ?> <!-- If there is nothing -->
		<h1>Not Found</h1>
		<?php endif; ?> <!-- END -->
	</div>
	<?php get_sidebar(); ?>
</div>
<?php get_footer(); ?>

Link to comment
Share on other sites

Google tells me that code is from a wordpress install, haven't played with WP much so you'll probably want to have this topic moved to the PHP Application board where someone may be able to help.

 

all I can suggest is to have a look around google or in your theme's config files and you should be modify it to display more posts.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.