WordPress.org

Ready to get started?Download WordPress

Forums

How to create a page showing both static and lastest blog post (4 posts)

  1. ryanweijian
    Member
    Posted 4 years ago #

    Hi to all.

    Does anybody knows how to create a welcome page (static)?

    [Top half of the webpage]
    I want to create a general welcome page (like a business profile + services) with some links in which to divert to other links example social media buttons to link to those sites?

    [Bottom half of the webpage]
    I want this part to show the summary/spinet of my latest blog posts

  2. Make a page template: Page Templates « WordPress Codex

    Use a custom query in the page template below your static text. This will show the excerpts from the latest 2 posts from the category "mycategory"; change to the name of your category:

    <?php $my_query = new WP_Query('category_name=mycategory&showposts=2'); ?><?php while ($my_query->have_posts()) : $my_query->the_post(); ?><a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a><?php the_excerpt(); ?><?php endwhile; ?>

    Set the page as a static page in Settings/Reading

  3. ryanweijian
    Member
    Posted 4 years ago #

    thanks for the hyperlink, i'll take a look and try to configure it.

    i've got another question in response to your reply.

    what if i want to allow excerpts of latest 5 posts from multiple categories instead of fixing it to just one?

    is there any way to go about this?

  4. You can use as many instances of that new_query above in a page by changing the category, but to make the code cleaner and do other things, you need to work more with query_posts: WordPress › Support » How do I show posts from multiple categories using WP_Query?

Topic Closed

This topic has been closed to new replies.

About this Topic