How to display content from post_parent

Not sure what I’m doing wrong here. I am a beginner coder, but I’ve tried a lot of things already:

I’m trying to print the_content from the post_parent of an image. Here’s what I’m using right now. I am able to post the title, but not the content (all I can succeed in printing content-wise is the image’s content (which is actually the image’s ‘description’ which is not what I’m looking for.

<?php echo wp_get_attachment_image( $post->ID, ‘post-image’ ); ?>
<h4 class=”attach-title”><?php the_title(); ?></h4>

<p><a href=”<?php echo get_permalink( $post->post_parent ); ?>” title=”<?php esc_attr( printf( __( ‘Return to %s’, APP_TD ), get_the_title( $post->post_parent ) ) ); ?>” rel=”gallery”><?php printf( ‘<span class=”meta-nav”>’ . __( ‘&larr; Return to %s’, APP_TD ) . ‘</span>’, get_the_title( $post->post_parent ) );
?></a></p>

<p><a href=”<?php echo get_permalink( $post->post_parent ); ?>” the_content=”<?php esc_attr( printf( __( ‘Return to %s’, APP_TD ), get_the_content( $post->post_parent ) ) ); ?>” rel=”gallery”><?php printf( ‘<span class=”meta-nav”>’ . __( ‘&larr; Return to %s’, APP_TD ) . ‘</span>’, get_the_content( $post->post_parent ) );
?></a></p>

The first 2 pieces of code work correctly, but the last paragraph is where I want to pull the content. But this code just prints the description of the image itself rather than the post_parent’s content.

Read more here:: How to display content from post_parent

Leave a Reply

Your email address will not be published. Required fields are marked *