jimmyt1988
Member
Posted 2 years ago #
Hi all,
I tried yesterday to figure this out. In fact I spent 2 hours on it.
When outputting links:
<?php
if($post->post_parent)
$children = wp_list_pages('title_li=&child_of='.$post->post_parent.'&echo=0');
else
$children = wp_list_pages('title_li=&child_of='.$post->ID.'&echo=0');
if ($children) { ?>
<ul>
<?php echo $children; ?>
</ul>
<?php } ?>
I want to add divs around the individual links:
<div style = "1"><div style = "a"><ul><li>link1</li></ul></div></div>
<div style = "2"><div style = "b"><ul><li>link2</li></ul></div></div>
<div style = "3"><div style = "c"><ul><li>link3</li></ul></div></div>
How the diddly do I do this. *wipes sweat from forehead*
jimmyt1988
Member
Posted 2 years ago #
Oh please someone help. I am desperate. I'm now trying to jquery stuff in :(
jimmyt1988
Member
Posted 2 years ago #
<li> THIS IS A LINK </li>
I need each link that is output to have a surrounding <div> tag like this:
<div><li> THIS IS A LINK </li></div>
you probably didn't get any help because your idea leads to invalid html.
if you could describe what you are trying to achieve, you might get more help.
general, you could work with 'str_replace()'
http://www.w3schools.com/php/func_string_str_replace.asp
jimmyt1988
Member
Posted 2 years ago #
Thanks for your help. I ended up adding stuff with jquery. Not as sexy as I'd hoped to make it but good enough for now. Thanks for your response :D