WordPress.org

Ready to get started?Download WordPress

Forums

Another n00b question (2 posts)

  1. TheJamesPorter
    Member
    Posted 1 year ago #

    Hi everyone,

    This is my first post, so forgive if it's in the wrong room. Also, forgive me as I'm very new to WordPress.

    I'm looking to develop two pages for my site that display two different categories. So page A will only show cat A and page B will only show cat B.

    I've done some research but I'm not any of the wiser. I've installed Category Pages & Posts Shortcodes plugin but am none of the wiser. Research suggests adding a line of code to the category template. I'm using the responsive theme which doesn't appear to have a category.php file to amend.

    Anyone recommend a way to solve this? Or an easier plugin which won't require editing code?

  2. Dandy Plow
    Member
    Posted 1 year ago #

    No need for plugins--get into your FTP and navigate to wp-content/themes/theme you're using

    There, make sure a category.php file exists. If not, create one with this content, otherwise, alter the content to match:

    <?php
    $post = $wp_query->post;
    if ( in_category('category number of first category') ) {
    include(TEMPLATEPATH . '/cata.php');
    } else if ( in_category('category number of second category') ) {
    include(TEMPLATEPATH . '/catb.php');
    }
    ?>

    This will reroute the user to either cata.php, or catb.php depending on the category.

    Next, you'll need to create and upload cata.php and catb.php to the ftp and give them the content you want.

Topic Closed

This topic has been closed to new replies.

About this Topic