WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Can I config category page to show only content ? (4 posts)

  1. hiddengibbon
    Member
    Posted 7 years ago #

    Can I config wordpress so when user click Category, There will only a list of post's content that match the selected category show up ?

    Million thanks for your suggestion,

  2. Andrew Ozz
    WordPress Dev
    Posted 7 years ago #

    You mean no title and post meta (date posted, author, etc.)? Sure, just edit the archive.php template in your theme, or make one if it doesn't exist.
    http://codex.wordpress.org/Stepping_Into_Templates

  3. hiddengibbon
    Member
    Posted 7 years ago #

    Hi, azaozz

    I mean when user click category.
    The page will display only a list of all post's subject that match selected category.

    Can I configure or edit something to match my requirement ?

  4. Andrew Ozz
    WordPress Dev
    Posted 7 years ago #

    Of course you can. The template to edit is still archive.php. Usually at the top there is something like this:

    if (is_category()) {
    ...
    } elseif( is_tag() ) {
    ...
    } elseif (is_day()) {
    ...

    etc.

    Change it to this:

    if (is_category()) {
        while (have_posts()) : the_post(); ?>
        <div class="post">
        <h3 id="post-<?php the_ID(); ?>">
        <a href="<?php the_permalink() ?>"
        rel="bookmark" title="Permanent Link to
        <?php the_title_attribute(); ?>">
        <?php the_title(); ?></a></h3></div>
        <?php endwhile;
    } else {
    
       if( is_tag() ) {
       ...
       } elseif (is_day()) {
       ...
       ...
       }
    ...
    ...
    (rest of the code here)
    }

    (note there's closing curly bracket at the end).

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags