Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

kikimarie123 on "Next/Previous Posts Link with Custom Post Type"

$
0
0

I'm using custom post type to query all the posts from post type: 'news-articles' and under a specific meta value. I've tried everything to get some next/previous links to appear and nothing is working.

Here is my code:

<div id="news-articles">
<?php
$args = array(
	'numberposts' => -1,
	'posts_per_page'  => 5,
	'post_type' => 'news-articles',
	'meta_key' => 'release_type',
	'meta_value' => 'In the News'
);

$the_query = new WP_Query( $args ); ?>

<?php if( $the_query->have_posts() ): ?>

	<?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>

		<div class="news-article" id="in-the-news">

		<div class="investment-image">

		<?php $associations = get_field('associations');
		if( $associations ): ?>

		<?php foreach( $associations as $association): ?>
			<?php
			$photo = get_field('investment_logo', $association->ID); ?>

			<a href="<?php the_permalink() ?>" title="<?php printf(__('%s','rys'), get_the_title()) ?>" rel="bookmark">
			<img src="<?php echo $photo['url']; ?>" alt="<?php echo $photo['alt']; ?>" />
			</a>

		<?php endforeach; ?>

		<?php endif; ?>

		</div><!-- .investment-image -->

		<div class="news-info">

		<strong><a href="<?php the_permalink() ?>" title="<?php printf(__('%s','rys'), get_the_title()) ?>" rel="bookmark" >
		<?php the_title(); ?></a></strong><br>

		<em><?php the_field('publication_source'); ?></em><br>

		<span><?php echo get_the_date(); ?></span><br>

		<a href="<?php the_permalink() ?>" title="<?php printf(__('%s','rys'), get_the_title()) ?>" rel="bookmark" class="more">more</a>

		</div><!-- end .new-info -->

		</div><!-- end .new-article -->

	<?php endwhile; ?>

<?php endif; ?>

<?php wp_reset_query();  // Restore global post data stomped by the_post(). ?>
</div><!-- end #news-articles -->

<?php americsecur_entry_bottom(); ?>
</div><!-- end of #post-<?php the_ID(); ?> -->

        <?php
		endwhile; 

		get_template_part( 'loop-nav' ); 

	else : 

		get_template_part( 'loop-no-posts' ); 

	endif;
	?>     

<?php wp_link_pages('before=<p>&after=</p>&next_or_number=number&pagelink=page %'); ?>

</div><!-- end of #content-section -->

<?php get_footer(); ?>

Nothing is working. I've tried multiple different code snippets and still nothing. Please help!


Viewing all articles
Browse latest Browse all 8245

Trending Articles