WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Wrapping text around links (5 posts)

  1. jimmyt1988
    Member
    Posted 4 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*

  2. jimmyt1988
    Member
    Posted 4 years ago #

    Oh please someone help. I am desperate. I'm now trying to jquery stuff in :(

  3. jimmyt1988
    Member
    Posted 4 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>
  4. alchymyth
    The Sweeper & Moderator
    Posted 4 years ago #

    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

  5. jimmyt1988
    Member
    Posted 4 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

Topic Closed

This topic has been closed to new replies.

About this Topic