1

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

1 Answer 1

2

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.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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