• Hey,
    I know this is a possibility, but i have no idea how to do it. I´m working on a wordpress site and want to have different news categories in fields, like the screenshot below.

    http://i45.tinypic.com/ws4g1l.png

    Could anyone help me find the way to do this? Thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Phil

    (@owendevelopment)

    You would have to code this in to the page template.

    Each box would call in the latest post(s) for each category, so for example:

    <div class="newsbox">
             <?php
                $boxnews = get_posts('numberposts=1&category=1');
                foreach($boxnews as $post) :
                setup_postdata($post);
             ?>
        <div class="news-item">
           <div class="news-text">
              <h2><span>Category Title 1</span> <?php the_title(); ?></h2>
              <?php the_content(); ?>
          </div>
       <div style="clear:both;"></div>
    </div> <!--eof latest-item -->
    <?php endforeach; ?>
    </div>

    numberposts=1&category=1 allows you to control how many posts are shown per box and from which category, so for 3 boxes, you would have 3 different categories for each one.

    Hope this helps.

    Phil

    Thread Starter Mikeyvdb

    (@mikeyvdb)

    Thank you so much Phil, the code worked perfectly. I added some stuff myself to just show the titles and made them link :)! Thank you very much for the help.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘News categories in different fields’ is closed to new replies.