Styling Inline Page Links
-
Hi peeps, at my wits end tried searching for this everyone but I think i’m maybe going about this in the wrong way, but hey.
I’m trying to style up the wp_list_pages “a” link using inline styling so that the page/ article ul li a background image can be pulled in dynamically from a custom field in a page.. the css then controls it’s roll over state moving the background a certain amouht of pixels etc.
I’ve found a way of hard coding an bg image in but i need to be dynamic etc.
I’m having an issue get the var $bg_img to echo out into the string style. see below
<?php $my_pages = wp_list_pages('echo=0&exclude=3,5,10,12,22,24&title_li='); $var1 = '<a'; $bgimg = bloginfo('template_directory').'/images/client_client_corner.gif'; $var2 = '<a style="background-image:url('.$bgimg.')"'; $var3 = '</a'; $var4 = '</a'; $my_pages = str_replace($var1, $var2, $my_pages); $my_pages = str_replace($var3, $var4, $my_pages); echo $my_pages; ?>Any ideas?
Andy.
The topic ‘Styling Inline Page Links’ is closed to new replies.