Get Parent Post (around Attachment)
-
Well first, i hope i’m right here. My question is mostly simple, but i cant release what i want to build, so i hope i get a small help here.
i’m rebuilding my own theme and want modify the attachment.php / image.php page.
what i want to build is, that these pages will show the Parent Post on the attachment page too. i know i can get the information like parent Post title on an easy way:
<?php $parent_title = get_the_title($post->post_parent); echo $parent_title; ?>
i thought it would be easier to build in the loop from the single.php file, which loads the content style from a own php templage file.
<?php while ( have_posts() ) : the_post(); get_template_part( 'content', get_post_format() ); <?php endwhile; else: ?> <p><?php _e('Sorry, no posts matched your criteria.'); ?></p> <?php endif; ?>
do you know an answer? or is there a more easier way?
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Get Parent Post (around Attachment)’ is closed to new replies.