WordPress.org

Ready to get started?Download WordPress

Forums

how does category really works? (4 posts)

  1. pedenski
    Member
    Posted 1 year ago #

    Ive been re-reading the codex and its just very confusing to me. ive been doing trial and error but cant seem to make it actually work the way i want it to be. please understand that im quite new in WP

    Questions below:

    1) is category.php necessary? is this something i need to show a posts from a specific category. (e.g cars) all cars posts should be displayed here
    OR its a page where all categories is listed (like if i have more than 1 categories)?

    2) i created a category.php and used this code

    <?php get_header(); ?>
    
    <?php
    /*
    Template Name: CARS
    */
    ?>
    
    <?php query_posts('category_name=cars&showposts=15'); ?>
    <?php while (have_posts()) : the_post(); ?>
            <li><a href="<?php the_permalink(); ?>">
              <?php the_content(); ?>
              </a>  </li>
            <?php endwhile; ?>
    
    <?php get_footer(); ?>

    ^ not sure if this is standard, or should i create a custom php page (like cars.php) and use it as a template page.

    regards.

  2. Pioneer Valley Web Design
    Member
    Posted 1 year ago #

    Have you tried the template CATEGORY NAME.php (for example...news.php)and associated menu item?

  3. pedenski
    Member
    Posted 1 year ago #

    yes, i did. as i said above. i created cars.php

    i just want to clarify the standards of putting category.php and its purpose.

  4. Pioneer Valley Web Design
    Member
    Posted 1 year ago #

    Review what (if) support for custom page templates is provided for/with theme/child theme.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags