I have following code to get all media attachment associated with any category:
<?php
$attachments = get_posts($args);
if ($attachments) {
foreach ($attachments as $post) {
setup_postdata($post);
?>
<li class='element <?php the_category($post->ID); ?>'>
<div class="portfolio-image">
<a href="#">
<?php echo '<img class="attachment-portfolio-four wp-post-image" src="'.the_attachment_link($post->ID,false).'" height="200" width="235">'; ?>
</a>
<div class="mask">
<div class="links">
<a data-gal="prettyPhoto[portfolios]" href="<?php the_attachment_link($post->ID); ?>"><i class="icon-resize"></i></a>
<a href="#">
<i class="icon-link"></i>
</a>
</div>
</div>
</div>
</li>
<?php } } ?>
But line
<?php echo '<img class="attachment-portfolio-four wp-post-image" src="'.the_attachment_link($post->ID,false).'" height="200" width="235">'; ?>
giving following output in HTML
<a href='http://koncept.org.in/wp-content/uploads/2016/02/vishal.jpg'><img width="150" height="150" src="http://koncept.org.in/wp-content/uploads/2016/02/vishal-150x150.jpg" class="attachment-thumbnail size-thumbnail" alt="vishal" /></a><img class="attachment-portfolio-four wp-post-image" src="" height="200" width="235"></a>
I want only media attachment url so i can use as i want. Can anybody help me out here?
This should work
Change
To