How can I make an image into a Wordpress link?
April 17, 2008 2:42 PM   Subscribe

I have an image. I have a Wordpress ?php previous_posts_link? . How can I make it so the image acts as that? I've googled and just can't find the right alchemy and I just know that other people are doing it.
posted by beaucoupkevin to Computers & Internet (9 answers total)
Don't use a solitary previous posts link, us the dynamic posts_nav_link, which will show previous and next post links when necessary:

?php posts_nav_link('this is what will appear in between','this is what you want newer posts link to be ','this is where you put what you want the previous posts link to be, and can even use IMG SRC tags within these apostrophes'); ?

Put that in between a set of >'s, and you're good. Is that clear enough?
posted by pedmands at 2:53 PM on April 17, 2008

But here's the rub: I have two different images I wish to use and a template that uses the solitary previous_posts and next_posts link, with the necessary alignments in place to have them appear on the opposite side of the bottom of the blog entry. Hm.
posted by beaucoupkevin at 3:08 PM on April 17, 2008

It should be possible to use classes and CSS to get your images to show up correctly using the technique pedmands describes.

If not, it should be possible to access some of WP's internal functions to give you more granular markup. I'd have to look into this.
posted by adamrice at 3:37 PM on April 17, 2008

then ?php previous_post_link('use image tags here'); ? should likely do it
posted by pedmands at 3:40 PM on April 17, 2008

?php previous_posts_link('Newer Entries »') ?

first hit on googling "previous_posts_link modifying". Looks like you can just enter the img src= inbetween >< (though reversed, of course) inbetween those apostrophes... give her a shot!
posted by pedmands at 3:47 PM on April 17, 2008

though upon preview, you should close the php with a ; after the apostrophe, exactly like the example I gave you here
posted by pedmands at 3:48 PM on April 17, 2008

Nope, it just gave the image location as a link when I enter ?php next_posts_link('img src='); ? or the IMG SRC variants,
posted by beaucoupkevin at 4:05 PM on April 17, 2008

you bracketed the img src between the ><?
posted by pedmands at 9:15 PM on April 17, 2008

Yes, inside of the brackets.
posted by beaucoupkevin at 3:47 AM on April 18, 2008

« Older I feel like I'm eating oil for breakfast   |   Austin public schools versus SF Bay Area public... Newer »
This thread is closed to new comments.