The way I retrieve posts on my blog is to use the following:
<?php $recentPosts = new WP_Query(); $recentPosts->query('showposts=5&cat=CAT_ID_GOES_HERE'); while($recentPosts->have_posts()): $recentPosts->the_post(); ?>
Then you would go and create the code to control the display of each post. So for a really simple example:
<h1 class="title"><a href="https://wordpress.stackexchange.com/questions/3170/<?php the_permalink(); ?>"><?php the_title(); ?></a></h1>
Then at the end of the posts you just have to end your while loop:
<?php endwhile; ?>
Related Posts:
- Show Default Editor on Blog Page ( Administration Panel )
- Display content from a specific category
- Modify theme to get page excerpts on front page
- How to query ‘posts_per_page’ to display a different blog posts index template?
- Dynamic Landing Page
- Get $post Object from another page
- Display Posts on Custom Page
- Determine if ID is page or post and query the ID
- Get all pages to display at once
- Multiple Loops That Pull Pages (Child/Grandchild) While Styling the First Entry
- Static Website No Titles But Still Nav
- Embedding Password Protected (Private) “Blog Posts” BLOCK that shows Images and Excerpts on Password Protected Page (not the home page)
- Is there anyway I can call the year once?
- WordPress blog posts template bug [closed]
- Pulling posts tagged with similar title name
- pagination does not work with query_posts. Help! [duplicate]
- How do you add a featured image to a page (not post)?
- Site Library issue
- Add infinite scroll to content splitted post
- Check if wp-login is current page
- How to get current page ID outside the loop?
- Contact Form on WordPress Sites?
- Page returns 404 with POST variables, but not without
- Custom templates not showing up in template dropdown
- How do I exclude a custom taxonomy from the post loop
- Getting only direct child pages in WordPress with get_pages
- Get page id by template
- Some doubts about how the main query and the custom query works in this custom theme?
- Using pre_get_posts on true pages and static front pages
- Get the content of a specific page (by ID)
- How to get page title with the page ID?
- Show more than 20 items in pages or posts edit dashboard
- Allowing user to edit only certain pages
- How to display last 3 posts (recent posts) in a static page?
- How to give paged links custom title?
- How to set post slug when using wp_insert_post();?
- How to get posts published between a date and today?
- How can I keep the content of my pages version controlled?
- How to load javascript on custom page template?
- How to check if I’m on the last page of posts?
- How to configure WordPress to handle 75,000 pages?
- How to update page status from publish to draft and draft to publish
- Check if is on child-page of a particular page
- Change page template programmatically ?
- Conditional tag to check if ‘page.php’ is being used?
- Customizing the URLs of WordPress Login and Sign-up Pages?
- How to disable posts and use pages only
- featured image as background image on pages
- Check IF is a “single product page” and Check the “role” for a Redirect
- A check for if is parent page, if has children, if has grandchildren
- How to load JS and CSS only on specific Pages using is_page()?
- Listing pages which uses specific template [duplicate]
- Proper way to get page content
- WP_Query vs get_posts
- Access the same page from multiple urls (wildcard)
- Create a page without adding a page in the Database
- Is there a way to change the default page template selection?
- Can I have two child pages of different parents with the same name?
- What methods to use to create small, editable pieces of text for static pages?
- Hide page visual editor if certain template is selected?
- What is the difference between $paged and $page?
- multi page password protection
- Create a “Dummy” parent page for a hierarchy in page listing?
- How do I convert a page’s title to lower case?
- Get top level page parent title
- How to add a specific widget to only 1 page?
- Restrict admin access to certain pages for certain users
- page title, parent tilte and grand parent title
- How to add jQuery script to an individual page?
- How to return results of a get_posts() in explicitly defined order
- WordPress page edit does not save selected template
- Add a Page without header and menus?
- What is an alternative to get_page_by_title()?
- Password protect page with multiple passwords
- Display all posts from specific categories on a page
- Create pages automatically if they don’t exist
- Using the Loop to show all levels of subpages under a parent page? Halfway there
- Find empty pages or pages which have less than x characters
- Allow only new sub-pages to be created
- Order posts by ID in the given order
- Set page template automatically based on parent
- Editing Complex Pages in Visual Mode
- Link section within page with slash (/) and not hash (#) without reloading the page
- Creating a template using a specific slug name, for a page with a parent page
- Can I display submenus in groups, using wp_list_pages?
- Is there a default template file for child pages / subpages?
- Get wp_get_attachment_url outside of loop
- Order by menu_order and title?
- Child Pages Loop
- Require title for pages
- WP Page and Subdirectory with same name
- Replace Dashes Before Title in Page List
- Add a new page to wordpress programmatically
- Get Permalink for the top level parent of child pages
- Proper method to restrict non logged users into certain pages
- Modify main WordPress loop with a parse_query filter
- How to redirect on particular page in wordpress? [closed]
- Get page id by title?
- Get the number of posts from the current page results
- How to exclude latest x posts from a paginated query?