Support » Plugin: Ambrosite Next/Previous Post Link Plus » Using PHP in array for image link

  • Resolved tokyobear


    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
                        ) ); ?>

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author ambrosite


    Try this:

    'link' => '<img src="' . get_bloginfo('template directory'). '/images/right-arrow.png" />',



    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…


    Plugin Author ambrosite


    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.



    I followed your advice using:

    bloginfo('template directory')

    to echo the function and I realised that I just needed the underscore! =)



Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Using PHP in array for image link’ is closed to new replies.