In WordPress, archive views display paged sets of posts. For example, viewing the category archive, the first 10 posts are displayed with a link for the next 10, and so forth. By default, WordPress displays all posts that belong to an archive. Here is a quick tutorial for displaying only submitted posts for archive (and other) views.

Display only Submitted Posts

To exclude all non-submitted posts from archive (and other) views, use the following code inside the Loop:

<?php // display only submitted posts
if (usp_is_submitted()) { ?>

	<div id="post-<?php the_ID(); ?>">
		<h2><?php the_title(); ?></h2>
		<?php the_content(); ?>
	</div>

<?php } else {
	// not a usp post
	continue;
} ?>

For example, if your archive template is archive.php, you would use this code in that file. Or to target a more specific archive, you can use this code in the loop of the associated template file (for example, category.php or tag.php).

So that’s the main idea, and you can get more specific by requiring other criteria to display archive posts.

Example time

For example, if your submitted posts have the author name attached via custom field named usp-author, then you could add something like this to the appropriate theme template (in the Loop):

<?php // display only usp author posts
if (usp_is_submitted()) {
	$usp_author = usp_get_meta(false, 'usp-author');
	if (isset($usp_author) && !empty($usp_author)) { ?>

		<div id="post-<?php the_ID(); ?>">
			<h2><?php the_title(); ?></h2>
			<?php the_content(); ?>
		</div>
	<?php }
} else {
	// not a usp post
	continue;
} ?>

Here, we are checking first to see if the current post in the loop is a submitted post. If it is, then we check to see if there is a specific custom field attached, specifically in this case, usp-author. If both conditions are true, then the post is displayed. Otherwise, the loop displays nothing and continues to the next post.