WordPress.org

Forums

PHP/CSS Help (2 posts)

  1. chea24
    Member
    Posted 2 years ago #

    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.

  2. Code Metic
    Member
    Posted 2 years ago #

    You have to include iteration stopper.

    Jquery or Javascript can handle that.

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

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.