How can I display the featured image of a post in a modal along with it's content.
With the help of a few online threads on similar issues, I tried this:
<?php
if ( has_post_thumbnail()) {
echo '<a href="' . get_permalink($post->ID) . '" >';
the_post_thumbnail('my_feature_image', array( 'class' => "someName" ));
echo '</a>';
}
?>
Which unfortunately returns the same featured image for all posts.
On the same header.php
where the modal is found, the following is there (above the modal divs):
$perma = false;
if ( isset( $wp_query->query_vars['phpost_slug'] ) ) #WHFIX 24/03/2015:
$perma = $wp_query->query_vars['phpost_slug'];
if( $perma ) {
//we don't want to return a 404
$wp_query->set( 'is_404', false );
$phid = get_page_by_path( $perma, OBJECT, 'post' );
$postvote = get_post_meta( $phid->ID, 'epicredvote', true );
$thumb = wp_get_attachment_image_src( get_post_thumbnail_id( $phid->ID ), 'single-post-thumbnail' );
$pluginfeat = get_post_meta( $phid->ID, 'phog', true );
$desc = get_post( $phid->ID )->post_content;
link to site: https://goo.gl/30a3QQ [Click on the post's row to open the modal.]