I'm trying to create a Ajax based category menu that reloads a section of the page with a couple posts from a specific categories based on the category menu item the user clicked.

Because my normal category archive pages show a 9 post grid and I just want this functionality to show 2, I was thinking the only way to accomplish this is to create some sort of alternate archive page that shows only 2 posts.

Is there a way to create a secondary archive page that each category will automatically render with?

For example, when I type in example.com/category then it'll show the default Archive page. I'm hoping for an alternate category page that will show up when I type in something like example.com/category-small or even example.com/category?count=2

If there's another way to accomplish the 2 post grid ajax menu I'm totally open to that as well.


You could copy the contents of your current archive page file into a new file, then tweak the functionality there into what you need it to do. At the top of the file, give it a template name like this:

  Template Name: Short Archive

Now you can create a new page and select this template from the WordPress admin interface.

| improve this answer | |
  • Would I then add a query string to pass in to generate the proper category? – Tanner Jun 2 '18 at 19:42
  • That's one option; the other is to check which category is being requested and then give out either version. Something like if is_category($category = 'automobiles')... More info here: developer.wordpress.org/reference/functions/is_category – Jay Versluis Jun 4 '18 at 3:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.