Jump to content

Trying to get PHP code to work in wordpress


crazyfish

Recommended Posts

I'm trying to use images for the next page and prev page links but I'm not very good with PHP so I think I am messing something up. If I put the relative path to the template the images work but if I try to call the images based on the template folder it fails. I'm trying to get the below code to work:

<?php posts_nav_link(' ','<img src="'.bloginfo('template_directory').'/images/left.png" />','<img src="'.bloginfo('template_directory').'/images/right.png" />'); ?>

 

but this is what it outputs which is all messed up.

 

http://mydomain.com/testwp/wp-content/themes/black bloghttp://mydomain.com/testwp/wp-content/themes/black blog<a href="http://mydomain.com/testwp/"><img src="/images/left.png" /></a><a href="http://mydomain.com/testwp/?paged=3"><img src="/images/right.png" /></a>

 

it should be

 

<a href="http://mydomain.com/testwp/"><img src="http://mydomain.com/testwp/wp-content/themes/black blog/images/left.png" /></a><a href="http://mydomain.com/testwp/?paged=3"><img src="http://mydomain.com/testwp/wp-content/themes/black blog/images/right.png" /></a>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.