WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Featured / Breaking News Post Outside Loop (2 posts)

  1. Connor Crosby
    Member
    Posted 2 years ago #

    I am making a WordPress theme that displays a breaking news post above the content and sidebar (outside the loop). I am using the following code to display any post with the tag "breaking":

    <?php
    if ($all_the_tags);
    $all_the_tags = get_the_tags();
    foreach($all_the_tags as $this_tag) {
    	if ($this_tag->name == "breaking" ) {
    ?>
    
    	<div class="breaking-news">
    		Post with tag 'breaking' goes here.
    	</div> <!-- end .breaking-news -->
    
    <? } } ?>

    So my question is how can I basically create a separate loop in that if statement to display any posts with the tag 'breaking'?

    I am not very good with PHP so an explanation would be extremely helpful! Thank you so much! :D

  2. Connor Crosby
    Member
    Posted 2 years ago #

    Wow, I should really google before posting here. I ended up code found on this page.

Topic Closed

This topic has been closed to new replies.

About this Topic