Advertisement
scotepi

Frame-able Wordpress.org Page

Aug 23rd, 2012
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.45 KB | None | 0 0
  1. <?php
  2.  
  3. header("Content-Type: text/html; charset=utf-8");
  4. require_once "wp-load.php";
  5.  
  6. date_default_timezone_set(get_option('timezone_string'));
  7.  
  8. // Get a specificed category
  9. if (isset($_GET['cat'])) {
  10.     $cat = get_category_by_slug($_GET['cat']);
  11.    
  12.     $cat_id = $cat->term_id;
  13. } else {
  14.     $cat_id = 0;
  15. }
  16.  
  17. // Get the posts
  18. $posts = wp_get_recent_posts(array(
  19.     'numberposts' => 10,
  20.     'offset' => 0,
  21.     'category' => $cat_id,
  22.     'orderby' => 'post_date',
  23.     'order' => 'DESC',
  24.     'post_type' => 'post',
  25.     'post_status' => 'publish',
  26.     'suppress_filters' => true,
  27. ));
  28.  
  29. ?><!DOCTYPE html>
  30. <html>
  31. <head>
  32.     <meta http-equiv="Content-Type" content="text/html;charset=utf-8" >
  33.    
  34.     <title><?= get_option('blogname') ?> - Recent Posts | <?= get_option('blogdescription') ?></title>
  35.    
  36.     <link rel="stylesheet" type="text/css" media="all" href="<?= get_stylesheet_directory_uri() ?>/style.css" />
  37.     <style type="text/css">
  38.     body {
  39.         background: #FFF;
  40.     }
  41.    
  42.     .gallery-size-thumbnail {
  43.         display: none;
  44.     }
  45.     </style>
  46. </head>
  47. <body>
  48. <div id="posts">
  49. <?php
  50. foreach ($posts as $post) {
  51.     $permalink = get_permalink($post['ID']);
  52.     $post_time = strtotime($post['post_date']);
  53.     $post_author = get_userdata($post['post_author']);
  54. ?>
  55.     <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">
  56.         <header>
  57.             <h1 class="entry-title"><a href="<?= $permalink ?>" title="<?= $post['post_title'] ?>" rel="bookmark"><?= $post['post_title'] ?></a></h1>
  58.             <div class="entry-meta">
  59.                 <span class="sep">Posted on </span>
  60.                 <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>
  61.                 <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>
  62.             </div>
  63.         </header>
  64.         <div class="entry-content"><?= apply_filters('the_content', $post['post_content']) ?></div>
  65.     </article>
  66. <?php } ?>
  67. </div>
  68. </body>
  69. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement