Forums

how to get attachment url link ? get_attachment_url not working (2 posts)

  1. keroseneskies
    Member
    Posted 7 months ago #

    I have a slider that links the images shown to the permalink page. I'm trying to change the php_the_permalink to one that would enable the images to link up with the link url of that image instead (which at the moment I have linked to another post)

    here's the current php:

    <div class="slide" style="display: none;">
          <?php if ( wpop_get_option( 'slider_caption' ) == 'yes' ): ?><h2><?php the_title(); ?></h2><?php endif; ?>
          <a href="<?php the_permalink(); ?> " title="<?php the_title(); ?>"><?php the_post_thumbnail( 'single-post-thumbnail', array( 'title' => the_title( '', '', false ) ) ); ?></a>
        </div>

    I know putting <?php wp_get_attachment_url( $id ); ?> on the " <a href " does not work as I don't believe this is the right code to retrieve the attachment image link (I dont mean the image url btw but the custom link you would put in an attachment image)

    Any help would be appreciated! Thanks.

  2. Marventus
    Member
    Posted 7 months ago #

    Hi,

    Your question is slightly confusing: are you trying to have the slider elements link to the attached image of each post instead of to the post itself?
    Also, a link to your site would help a lot.
    Thanks!

Reply

You must log in to post.

About this Topic