Support » Fixing WordPress » PHP/CSS Help

  • Okay, so I have this code for a custom field which I place in the content area of single.php

    <?php
    $url = get_post_meta($post->ID, 'youtube', false); foreach($url as $url)
    if($url != '') : ?>
    <a href="<?php echo $url; ?>">Youtube</a></p>
    <?php endif; ?>

    What it does is shows an text link within the content area of my posts, right below my post text. But when I post multiple text links it shows up like this:

    Youtube
    Youtube
    Youtube
    Youtube
    Youtube

    And so on… What I want it to do is only show 4 links until it moves over to the top. Like this:

    Youtube Youtube
    Youtube
    Youtube
    Youtube

    So I guess I need to do something in the CSS for that to happen? Or maybe add some code to the current code I have? Any guidance would help a lot.

Viewing 1 replies (of 1 total)
  • Code Metic

    (@noemermidagmailcom)

    You have to include iteration stopper.

    Jquery or Javascript can handle that.

    I think you miss <p> for closing </p> tag.

Viewing 1 replies (of 1 total)
  • The topic ‘PHP/CSS Help’ is closed to new replies.