- This topic has 1 reply, 2 voices, and was last updated 9 years, 9 months ago by .
Viewing 2 posts - 1 through 2 (of 2 total)
Viewing 2 posts - 1 through 2 (of 2 total)
These forums are now closed and remain for historical purposes.
None of the content applies to the new version 3. For support, get in touch via our contact form.
Forums › Forums › Search & Filter Pro › Link results to media file URL not attachment page
Currently I am displaying my results in a list format and want each item to link to its file URL, but it currently links to the file attachment page. I have spent a long time searching for solutions but nothing.
Here is the code I am working with in results.php:
<div class="results">
<?php
while ($query->have_posts())
{
$query->the_post();
?>
<div class="thumbs">
<a href="<?php the_permalink(); ?>">• <?php the_title(); ?></a>
<?php
}
?>
</div>
</div>
You need to be using the get_attachment_url, I think. See here:
https://codex.wordpress.org/Function_Reference/wp_get_attachment_url