Add category archives to a page (in Thesis)


/ Published in: PHP
Save to your folder(s)

The function content should work in any theme, it's just wrapped in a function wrapper for insertion into the Thesis theme.


Copy this code and paste it in your HTML
  1. function add_category_archives() {
  2. if (is_page('page')) {
  3. $archive_query = new WP_Query('showposts=1000&category_name=Category');
  4. if ($archive_query->have_posts()) echo '<h2>Category Posts</h2>';
  5. $post_count = 1;
  6. while ($archive_query->have_posts()) {
  7. $archive_query->the_post();
  8. ?>
  9. <div class="post_box hentry<?php if ($post_count == 1) echo(' top'); ?>">
  10. <?php thesis_headline_area(); ?>
  11. </div>
  12.  
  13. <?php
  14. $post_count++;
  15. }
  16. }
  17. }
  18. add_action('thesis_hook_after_content', 'add_category_archives');

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.