0

I would like to take a value from input "link to" in Photo Gallery by PHP and put it in <a> tag. Something like this:

$gal_id = (int) $gallery[ $i ];
echo '<a href="' . esc_url( wp_get_attachment_url( $gal_id ) ) . '"</a>

but instead of wp_get_attachment_url( $gal_id ) I want my link from "link to".

Ankur Bhadania
  • 4,123
  • 1
  • 23
  • 38
  • What do you mean by "link to"? – Kris Aug 25 '17 at 05:58
  • When I click on a photo in Photo Gallery, there are fields to fill like: URL, Title, Caption, Alt text, Description, Link to, Link target. I would like to enter a link to "Link to", and then using php to retrieve this value. –  Aug 25 '17 at 06:10
  • Maybe this is what you are looking for : https://wordpress.stackexchange.com/questions/14773/retrieving-a-custom-link-on-an-attachment – Kris Aug 25 '17 at 06:14
  • I prefer to not update Link URL on image but take a value from a field "link to" . –  Aug 25 '17 at 07:01

0 Answers0