Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- header("Content-Type: text/html; charset=utf-8");
- require_once "wp-load.php";
- date_default_timezone_set(get_option('timezone_string'));
- // Get a specificed category
- if (isset($_GET['cat'])) {
- $cat = get_category_by_slug($_GET['cat']);
- $cat_id = $cat->term_id;
- } else {
- $cat_id = 0;
- }
- // Get the posts
- $posts = wp_get_recent_posts(array(
- 'numberposts' => 10,
- 'offset' => 0,
- 'category' => $cat_id,
- 'orderby' => 'post_date',
- 'order' => 'DESC',
- 'post_type' => 'post',
- 'post_status' => 'publish',
- 'suppress_filters' => true,
- ));
- ?><!DOCTYPE html>
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html;charset=utf-8" >
- <title><?= get_option('blogname') ?> - Recent Posts | <?= get_option('blogdescription') ?></title>
- <link rel="stylesheet" type="text/css" media="all" href="<?= get_stylesheet_directory_uri() ?>/style.css" />
- <style type="text/css">
- body {
- background: #FFF;
- }
- .gallery-size-thumbnail {
- display: none;
- }
- </style>
- </head>
- <body>
- <div id="posts">
- <?php
- foreach ($posts as $post) {
- $permalink = get_permalink($post['ID']);
- $post_time = strtotime($post['post_date']);
- $post_author = get_userdata($post['post_author']);
- ?>
- <article id="post-<?= $post['ID'] ?>" class="post-<?= $post['ID'] ?> post type-post status-publish format-standard hentry category-community tag-hunger tag-rotary-club tag-winthrop-rotary-club">
- <header>
- <h1 class="entry-title"><a href="<?= $permalink ?>" title="<?= $post['post_title'] ?>" rel="bookmark"><?= $post['post_title'] ?></a></h1>
- <div class="entry-meta">
- <span class="sep">Posted on </span>
- <a href="<?= $permalink ?>" title="<?= date('g:i a', $post_time) ?>" rel="bookmark"><time class="entry-date" datetime="<?= date(DateTime::ATOM, $post_time) ?>"><?= date('F j, Y', $post_time) ?></time></a>
- <span class="by-author"> <span class="sep"> by </span> <span class="author vcard"><a class="url fn n" href="<?= get_author_posts_url($post['post_author']) ?>" title="View all posts by <?= $post_author->display_name ?>" rel="author"><?= $post_author->display_name ?></a></span></span>
- </div>
- </header>
- <div class="entry-content"><?= apply_filters('the_content', $post['post_content']) ?></div>
- </article>
- <?php } ?>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement