• Resolved jimmyt1988

    (@jimmyt1988)


    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*

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter jimmyt1988

    (@jimmyt1988)

    Oh please someone help. I am desperate. I’m now trying to jquery stuff in 🙁

    Thread Starter jimmyt1988

    (@jimmyt1988)

    <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

    Thread Starter jimmyt1988

    (@jimmyt1988)

    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 😀

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Wrapping text around links’ is closed to new replies.