Not sure how to do this, I want to silo structure my site and I have created a category and put all my posts under that category.

I want to now create a page that has the same slug as the category and have that take priority over the category slug when going to that URL.

Whats the easiest way to do this?


2 Answers 2


It isn't too clear what's your actual reason for doing this, so it's hard to guess the perfect solution.

On top of my head it's likely you would probably do well to create or modify category template. This will give you control over page source for that precise category.

If you want to do this literally as you put it however it would be much more involved and less robust. The most smooth way I can think of would probably be to use custom taxonomy without archive, so that the URL isn't “taken” by it.


As Rarst noted, the easy option would be to modify your category.php file (if you have one)

If you do not have a category.php template_, you can make one by copying your archive.php file or your index.php file with the name category.php

If you want this only for one category, you can create a custom category template: One option to avoid having to do this would be to copy your current archive.php page (or if it does not exist, copy your index.php page) as category-<slug_name>.php or category-<category_id>.php where:

  • would be the name of the category slug you are using. e.g. category-test.php
  • would be the id of the category you are using. e.g. category-2.php

You can then style it as wanted.

If you need to show all posts, you could use the pre_get_posts filter on the category in question:

function do_my_filter_special_category( WP_Query $query ) {
    if ( !is_admin() && is_main_query() && is_category( YOUR_CATEGORY_ID_HERE ) ) {
        $query->set('posts_per_page', -1);
add_action('pre_get_posts', 'do_my_filter_special_category');

Another option would be to create create a custom page template:

  1. Copy your page.php file (or index.php if you do not have one) as pagetemplate-all-cats.php (or whatever floats your boat)
  2. At the top of the file, add the following code:

The below lines should be three lines at the top of the file followed by the code below it. (I have no idea how to get the comment block to show properly...)

/* Template Name: Show All Categories */

$arguments = array(
    'cat' => <your_category_id_here>,
    'posts_per_page' => -1

$all_cats = new WP_Query();

if ( $all_cats->have_posts() ) {
    while ( $all_cats->have_posts() ) {
        $current = $all_cats->next_post();

        $id = $current->ID;

        echo "<p>Other Fields:</p><pre>" . print_r($current, true) . "</pre>";
} else {
    echo "<p>No categories to show</p>";

You could take this a step further and create a custom meta box for your post template so that you could show which category to show posts for.

Another option would be to make all of your posts show on your blog:

  1. Set your front page to show the blog
  2. Change your posts per page to be -1 (or use the pre_get_posts filter and check for is_home() instead of is_category(n))
  • Well the reason I wanted to do was it to design my website in a silo structure. In this particular case I am using the thesis theme so it doesn't have a category.php. Let me look more into this guys. Thanks so much for all the input :)
    – Moses
    Commented Jan 27, 2015 at 22:13
  • Even if it does not have category.php, you should still be able to use a copy of archive.php (renamed category.php or category-(catname).php). That will override your categories lists (or a specific one).
    – Privateer
    Commented Jan 27, 2015 at 23:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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