Full Width Main Post

On my site I want to add a section just below Navigation and above-content (from where posts starts to show up on front page) which would show a panel where I can put any BREAKING NEWS (not always, whenever I want) with its excerpt and image. That panel should stretch with max-width.

I want to pull that BREAKING NEWS from a specific category say – category_breaking.

Read More

Is it possible? If yes, then how?

Thanks for the help.

I want to achieve exactly like this – (http://i.imgur.com/4D9kE.png)

Related posts

Leave a Reply

1 comment

  1. It’s certainly possible, and is a common thing to do with WordPress:

    <?php
      $q = new WP_Query('category_name=category_breaking'); // query that gets all posts in category "category_breaking"
      if( $q->have_posts() ) : // if there are posts returned by query...
        echo "<div id='breaking_news'>"; // start the breaking news section
        while( $q->have_posts() ) : $q->the_post(); // start looping through query results
          echo "<div class='bn_post'>"; // single breaking news post start
          echo "<h2>".get_the_title()."</h2>"; // display breaking news post title
          if(has_post_thumbnail()) // if post has featured image set...
          {
            the_post_thumbnail(); // then display featured image
          }
          echo "</div>"; // close single breaking news post
        endwhile;
        echo "</div>"; // close breaking news section
      endif;
    ?>