theme-text.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. global $newsletter; // Newsletter object
  3. global $post; // Current post managed by WordPress
  4. if (!defined('ABSPATH'))
  5. exit;
  6. // This file is included inside a function so it inherit all the local variables.
  7. // Since a theme has it's own options, it must check if there is new content to send
  8. // out.
  9. // Inside $theme_options['last_time'] there is the time stamps of the last run
  10. // to be used to decide if we need to stop or not.
  11. $filters = array();
  12. $filters['posts_per_page'] = (int)$theme_options['max_posts'];
  13. if ($filters['posts_per_page'] == 0) $filters['posts_per_page'] = 10;
  14. // This theme has an option with categories to be included.
  15. if (is_array($theme_options['categories'])) {
  16. $filters['cat'] = implode(',', $theme_options['categories']);
  17. }
  18. $posts = get_posts($filters);
  19. // Retrieve the posts asking them to WordPress
  20. $posts = get_posts($filters);
  21. ?><?php echo $theme_options['theme_opening_text']; ?>
  22. * <?php echo $theme_options['theme_title']; ?>
  23. <?php
  24. foreach ($posts as $post) {
  25. // Setup the post (WordPress requirement)
  26. setup_postdata($post);
  27. ?>
  28. <?php the_title(); ?>
  29. <?php the_permalink(); ?>
  30. <?php } ?>
  31. <?php echo $theme_options['theme_footer_text']; ?>