Reputation: 1624
I have created a custom post type, which is poping up through a plugin. But image is not showing up in popup so I want to call image in href tag and i don't know how to call it.
There some codes
<?php
$args = array( 'post_type' => 'Gallery', 'posts_per_page' => All );
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post();
echo '<div class="thumbnail-container"><div class="thumbnail-wrap"><a title"" rel="lightbox" href="#" >';
the_post_thumbnail(full);
echo '</a><div class="thumbnail-containt">';
the_content();
echo '</div></div></div>';
endwhile;
?>
Upvotes: 0
Views: 1907
Reputation: 1325
<?php
$args = array( 'post_type' => 'Gallery', 'posts_per_page' => All );
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post();
$large_image_url = wp_get_attachment_image_src( get_post_thumbnail_id(), 'large');
echo '<div class="thumbnail-container"><div class="thumbnail-wrap"><a title"" rel="lightbox" href="'.$large_image_url[0].'" >';
the_post_thumbnail(full);
echo '</a><div class="thumbnail-containt">';
the_content();
echo '</div></div></div>';
endwhile;
?>
Replace this code.
Upvotes: 2
Reputation: 1566
Use wp_get_attachment_image_src
to get image url
<?php
$args = array( 'post_type' => 'Gallery', 'posts_per_page' => All );
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post();
$image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' );
echo '<div class="thumbnail-container"><div class="thumbnail-wrap"><a title="" rel="lightbox" href="$image" >';
the_post_thumbnail(full);
echo '</a><div class="thumbnail-containt">';
the_content();
echo '</div></div></div>';
endwhile;
?>
Upvotes: 0
Reputation: 23883
your title
tag maybe ?
change title""
to title=""
<?php
$args = array( 'post_type' => 'Gallery', 'posts_per_page' => All );
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post();
echo '<div class="thumbnail-container"><div class="thumbnail-wrap"><a title="" rel="lightbox" href="#" >';
the_post_thumbnail(full);
echo '</a><div class="thumbnail-containt">';
the_content();
echo '</div></div></div>';
endwhile;
?>
Upvotes: 0
Reputation: 8809
I feel your should try
$imageUrl = wp_get_attachment_url( get_post_thumbnail_id($post->ID, 'thumbnail') );
<img src="<?php echo $imageUrl; ?>" />
Upvotes: 0