This website uses cookies to remember you and improve your experience. For more info see our Privacy Policy.

  • About
  • Websites
    • Business Websites
    • Author Websites
  • SEO
  • Portfolio
    • Author Web Design
    • Business Web Design
    • Custom Graphics
    • Logos
  • Services & Pricing
    • Author Website Packages
    • Website Hosting
    • Page Speed Optimization
    • SEO
    • Local SEO
  • MyBookTable
    • MyBookTable Support
  • Contact
  • Hire Us

Mobile Menu

  • Menu
  • Skip to right header navigation
  • Skip to main content

Stormhill Media

Custom websites for every type of business

Header Right

  • About
  • Websites
    • Business Websites
    • Author Websites
  • SEO
  • Portfolio
    • Author Web Design
    • Business Web Design
    • Custom Graphics
    • Logos
  • Services & Pricing
    • Author Website Packages
    • Website Hosting
    • Page Speed Optimization
    • SEO
    • Local SEO
  • MyBookTable
    • MyBookTable Support
  • Contact
  • Hire Us

Code Snippets

Home » Code Snippets

Get Posts

by Daniel Camomile · In: Code Snippets · on Jan 19, 2012

This is a basic get_posts <?php $args = array( ‘numberposts’ => 5, ‘offset’ => 0, ‘category’ => 5, ‘orderby’ => ‘post_date’, ‘order’ => ‘DESC’, /* ‘include’ => , ‘exclude’ => , ‘meta_key’ => , ‘meta_value’ => , */ ‘post_type’ => ‘post’, /* ‘post_mime_type’ => , ‘post_parent’ => , */ ‘post_status’ => ‘publish’ ); ?> <?php $newsposts = get_posts( $args ); ?> <?php foreach($newsposts as $post) : setup_postdata($post); ?> // normal post tags and content <?php endforeach; ?>

Get PostsRead More

Category: Code Snippets

  • « Go to Previous Page
  • Page 1
  • Page 2
  • Page 3

Site Footer

Quick Links:

  • Contact Us
  • Pricing & Services
  • Sitemap
  • Terms/Conditions
  • Privacy Policy
  • Business Websites
  • Author Websites
  • SEO Services
(903) 213-5266‬

Copyright © 2025 · Stormhill Media All Rights Reserved.
Website by Stormhill Media
Log in