Title: Using PHP in array for image link
Last modified: August 21, 2016

---

# Using PHP in array for image link

 *  Resolved [tokyobear](https://wordpress.org/support/users/tokyobear/)
 * (@tokyobear)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/using-php-in-array-for-image-link/)
 * Firstly — thank you for the plugin. It’s absolutely great!
 * I have one question about using PHP in my array for the image link. I think I
   have to use get_bloginfo() to get the correct directly since…
 * `<img src="images/right-arrow.png" />`
 * … doesn’t show the image. But I can’t use php inside the text if I start ‘img
   src=…
 * Currently my array is as per below, but for the ‘link’ it is just outputting [
   site name]/images/right-arrow.png as text… What should I do? Thanks in advance!!
 *     ```
       <?php next_post_link_plus( array(
                           'order_by' => 'post_date',
                           'loop' => true,
                           'format' => '%link',
       		    'link' => get_bloginfo('template directory').'/images/right-arrow.png',
                           'in_same_cat' => true,
                           'in_same_tax' => true
                           ) ); ?>
       ```
   
 * [http://wordpress.org/plugins/ambrosite-nextprevious-post-link-plus/](http://wordpress.org/plugins/ambrosite-nextprevious-post-link-plus/)

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Plugin Author [ambrosite](https://wordpress.org/support/users/ambrosite/)
 * (@ambrosite)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/using-php-in-array-for-image-link/#post-4150120)
 * Try this:
 * `'link' => '<img src="' . get_bloginfo('template directory'). '/images/right-
   arrow.png" />',`
 *  Thread Starter [tokyobear](https://wordpress.org/support/users/tokyobear/)
 * (@tokyobear)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/using-php-in-array-for-image-link/#post-4150125)
 * Thank you for the prompt response!
 * I’m afraid that didn’t work. Incidentally, I’m testing on a localhost if that
   makes any difference?? I know the following works in CSS:
 * `background-image: url(../mulberry/images/background-3.png);`
 * And I tried adding the ‘mulberry’ (theme name) into your code:
 * `'<img src="' . get_bloginfo('template directory'). 'mulberry/images/right-arrow.
   png" />',`
 * But to no avail. I’m sure the issue is my end so I’ll keep on trying…
 * Thanks.
 *  Plugin Author [ambrosite](https://wordpress.org/support/users/ambrosite/)
 * (@ambrosite)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/using-php-in-array-for-image-link/#post-4150135)
 * Have you tried viewing the HTML source on that page to see what is actually being
   output by the function? I think you are probably very close, it is just a matter
   of getting the URL right.
 *  Thread Starter [tokyobear](https://wordpress.org/support/users/tokyobear/)
 * (@tokyobear)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/using-php-in-array-for-image-link/#post-4150138)
 * I followed your advice using:
 * `bloginfo('template directory')`
 * to echo the function and I realised that I just needed the underscore! =)
 * `get_bloginfo('template_directory')`
 * Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Using PHP in array for image link’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/ambrosite-nextprevious-post-link-
   plus.svg)
 * [Ambrosite Next/Previous Post Link Plus](https://wordpress.org/plugins/ambrosite-nextprevious-post-link-plus/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/ambrosite-nextprevious-post-link-plus/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/ambrosite-nextprevious-post-link-plus/)
 * [Active Topics](https://wordpress.org/support/plugin/ambrosite-nextprevious-post-link-plus/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/ambrosite-nextprevious-post-link-plus/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/ambrosite-nextprevious-post-link-plus/reviews/)

## Tags

 * [images](https://wordpress.org/support/topic-tag/images/)

 * 4 replies
 * 2 participants
 * Last reply from: [tokyobear](https://wordpress.org/support/users/tokyobear/)
 * Last activity: [12 years, 8 months ago](https://wordpress.org/support/topic/using-php-in-array-for-image-link/#post-4150138)
 * Status: resolved