Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am new to WP.

What i allready have -

I am building a news blog with few posts categories. each category function as a different section (Economics, Sports etc.)

What i want to achieve-

What i am trying to achieve is to set a static page that will preview the last post from each category and will serve as the main page of the "news site".

  1. how can i nest posts preview on a static page (I understand that static pages are posts right?).
  2. is there a way to retrieve all the posts from a specific date?
  3. is there a way to group them by category?

I know it is a "Big" question. I am only looking for directions and not tutorial.

Thanks a lot

Shani

share|improve this question

1 Answer 1

up vote 2 down vote accepted

You will need to set a Static Page as your front page, create and assign a PHP Template for that page, and stack multiple Queries in the template to search out your required categories and display them. Here is one, you might have many:

// get the last post (any date) from 'Featured' category
$featured = new WP_Query( 'category_name=Featured&posts_per_page=1' );
if ( $featured->have_posts() )
{
    while ( $featured->have_posts() )
    {
        $featured->the_post(); // fill $post with data
        ?>
            <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
                <!-- output markup and display the post(s) -->
            </div>
        <?php 
    }
}
rewind_posts();

// start next query

That should give you an idea, at least, there is a fair bit to it. Good luck.

share|improve this answer
    
Hey. thats sounds simple. I will try it. thanks. –  shannoga Jun 13 '11 at 8:10

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.