WordPress.org

Support

Support » Themes and Templates » Trouble with Archive Page

Trouble with Archive Page

  • I’m sure there’s a simple fix, but I can’t find the problem.

    I’m using the Thesis theme.

    I cut/pasted code for an Archive Page into my Custom_Functions.php file that includes links to the last 15 posts.

    It seems to be treating the last in the list as an actual post, and showing tags and comments from the last link in the list at the bottom of the page.

    It can be seen at:
    http://www.morebettersmarts.com/archives-6/

    The code from the php file is below. Any help is greatly appreciated.

    Thanks

    /* ———————————-
    CUSTOM ARCHIVE PAGE
    ———————————- */

    function my_archive() {
    ?>
    <div class=”archive”>
    <table border=”0″>
    <tr>
    <td width=”50%” valign=”top”>
    <h2>Categories</h2>

      <?php wp_list_categories(‘orderby=name’); ?>

    </td>
    <td width=”50%” valign=”top”>
    <h2>Tags</h2>
    <?php wp_tag_cloud(‘smallest=8&largest=20’); ?>
    </td>
    </tr>
    </table>

    <h2>Last 15 Posts</h2>

    <?php
    $my_query = new WP_Query(‘post_type=post&nopaging=1’);
    if($my_query->have_posts())
    {
    echo ‘

      ‘;
      $counter = 1;
      while($my_query->have_posts() && $counter<=15)
      {
      $my_query->the_post();
      ?>

  • ” rel=”bookmark” title=”Permanent Link to <?php the_title_attribute(); ?>”><?php the_title(); ?>
  • <?php
    $counter++;
    }
    echo ‘
    ‘;
    }
    ?>

    <h2>By Month</h2>
    <p><?php wp_get_archives(‘type=monthly&format=custom&after= |’); ?></p>
    </div>
    <?php
    }
    remove_action(‘thesis_hook_archives_template’, ‘thesis_archives_template’);
    add_action(‘thesis_hook_archives_template’, ‘my_archive’);

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Trouble with Archive Page’ is closed to new replies.
Skip to toolbar