Quantcast
Channel: WordPress.org Forums » All Topics
Viewing all articles
Browse latest Browse all 64413

How do I edit archive.php to sort posts by category?

$
0
0

Replies: 0

Here’s the deal, I’ve made a copy of Virtue’s archive.php (called archive-supplier_post.php) to display my custom post type Supplier.

I’m having problems understanding some of the archive.php content but I did manage to get my posts to show after some trial and error.

This is a particular part of the code that I have literally no idea what it does:

 <?php if(isset($virtue['blog_archive_full']) && $virtue['blog_archive_full'] == 'full') {
            $summery    = 'full';
            $postclass  = "single-article fullpost";
          } else {
            $summery = 'normal';
            $postclass = 'postlist';
          } ?>

$summery is later used here to display the posts:

<?php if($summery == 'full') {
            while (have_posts()) : the_post();
              get_template_part('templates/content', 'fullpost');
            endwhile;
          } else {
            while (have_posts()) : the_post();
              get_template_part('templates/content', get_post_format());
            endwhile;
          }

What is summery and what is blog_archive_full? Can I strip this code down a bit to only simply display my custom posts (by categories)

If someone could help me understand the code in the archive.php and/or simply help me by giving me some snippets to put in my archive-custom-post to divide posts by category (in divs by category), I would be so grateful.

Thanks,
JT


Viewing all articles
Browse latest Browse all 64413

Trending Articles