loading
I am currently not available for projects
logo

Hi, I'mKevin Shoffner

Creating Custom Template Pages

Let’s say you wanted a WordPress page that did nothing more than show all POSTS under one Category in your WordPress site to be displayed on one page…

How hard could that be?  Not too bad, actually.

    1. You will need to go to your FTP program, where your current theme is located, then duplicate the “page.php” and call it something like “category-list.php”
    2. Now, go to your Editor within your WP Dashboard
    3. From here you just need to put a little custom code in your newly created page
    4. At the top of the file put the following (I usually put directly before seeing <?php get_header(); ?>:


<?php
/*
Template Name: Category
*/
?>

    1. Now you need this code inside your new file, of course changing the “cat=” to whatever number the category you want it to be:


<?php
query_posts('cat=1');
while (have_posts()) : the_post();
the_content();
endwhile;
?>

You will now be able to go to Pages >> Add New >> and be able to select the Template “Category” as a template. Give the Page a name, and you are good to go.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: