Get parent post pagination links
-
Hi,
I’m trying to get the links for the previous and next posts of the parent post when viewing an image attachment. This is the code I have so far:
<?php $parentID = $parent->ID; $parentPostType = $parent->post_type; $args = array('post_type' => $parentPostType); $loop = new WP_Query($args);?> <?php while ( $loop->have_posts() ) : $loop->the_post(); ?> <?php previous_post_link(); ?> <?php next_post_link(); ?> <?php endwhile; ?>
Does anyone have any idea where I’m going wrong?
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Get parent post pagination links’ is closed to new replies.