Question

My goal is to create a dynamic list of links next to each other (not on top of each other). So far I have the links outputting correctly using Simplepie and an Atom datasource but for some reason my output has a linebreak between each new item in the for each statement. Is it possible to skip the line break and put the output items next to each other instead? I am not getting any errors, just not getting my goal output. Please help this is making me age at an exponential rate :)

<body>
<?php
foreach ($feed->get_items() as $item):
?>
<div class="item"><a href="<?php echo $item->get_permalink(); ?>"><?php echo $item-    >get_title(); ?></a></div><?php endforeach; ?>
</body>
Was it helpful?

Solution

Put the links in a <ul> (Unordered list element) with style of float:left like so

<body>
    <ul>
        <?php
            foreach ($feed->get_items() as $item):?>
                <li class="item"><a href="<?php echo $item->get_permalink(); ?>"><?php echo $item- >get_title(); ?></a>
                </li>
            <?php endforeach; ?>
    </ul>
</body>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top