How do I group my articles by category?

This answer assumes that:

  • You are using the issuem_articles shortcode to generate your article list
  • You are using Article Categories to organise your issues

Step 1 – check that you are outputting the category in the article listing format.

In the WordPress Admin interface go to Articles > IssueM Settings and scroll down to IssueM Article Shortcode Format. Make sure the textbox contains:

%CATEGORY[1]%

Step 2 – add category ordering to the issuem_articles shortcode

Go to your Current Issues page and add

use_category_order="true"

to the shortcode. If your Current Issues page is blank then enter the following:

[[issuem_featured_rotator]][[issuem_featured_thumbnails max_images="3"]][[issuem_articles]]

And click on Update. This is the default IssueM output.

If you check your page now, you should have the articles coming out in category order but we still need a tweaks to only display the category name once.

Step 3 – displaying a single category name

There’s currently no way to control the output of the category name via the shortcode so we are going to cheat and do it with Javascript.

There are multiple ways to add this code to your WordPress site but if your theme doesn’t provide this functionality, the easiest way is via a plugin such as Inject-O-Matic (just search for this in Plugins > Add New).

Go to the code entry on your theme or Settings > Inject-O-Matic if you’ve used this plugin and add the following:

jQuery(document).ready(function( $ ){  	

var curr_cat = ''; 	 	

$('.issuem_article_category').each(function( index ){  		

if ( $(this).text() == curr_cat ) {  		  			

$(this).hide();    		

} else {  			

curr_cat = $(this).text();  		

}  		  	

});   

});

Click on Save Changes.

Now when you view your page you should see articles listed “under” their categories.

Still need help? Contact Us Contact Us