Category page to display list of posts only (17 posts)

  1. sparrowdog
    Posted 9 years ago #

    I would like my category pages to only display a list of the posts in that category and not any of the post itself.

    Is this possible?

  2. Silkjaer
    Posted 9 years ago #

    if you have a category.php in the themes folder, the look of the category pages are defined here... The template tags called inside the loop (eg. <?php the_content(); ?> = the post content) defines what is shown of the posts.. That means, if you remove the template tag the_content(); from category.php, no post content is showed - you want to do that for more than this template tag (eg. the_time(); etc).. Take a look at the codex (http://codex.wordpress.org/template_tags) for a list of template tags.

  3. mollysummer
    Posted 9 years ago #

    my theme doesn't seem to have a category page. When I click a category, I have this link: http://www.thecowgoddess.com/wordpress/?cat=1

    So how can I get my category display to display lists instead of posts?

  4. moshu
    Posted 9 years ago #

    If you don't have it - just create one. Save your archive.php as category.php or category-XX.php (where XX = ID of category) and you are good to go.
    More: Category_Templates and Template_Hierarchy.

  5. mollysummer
    Posted 9 years ago #

    I'm stuck again! I did make a category page, but I'm lost as to how to get the categories to display! At this moment, nothing displays at all. I cloned the category page from the default template. I'm sure I'm missing a step, or something.


  6. moshu
    Posted 9 years ago #

    What is the "default template"?
    (I've said: save your archive.php as category.php...)

  7. mollysummer
    Posted 9 years ago #

    I did that, and now I get the following error when I try to access a category:

    Archive for the '2004' Category
    Fatal error: Call to undefined function: cat_header_link() in C:\Domains\thecowgoddess.com\wwwroot\wordpress\wp-content\themes\hathor\category.php on line 9

  8. moshu
    Posted 9 years ago #

    There is no cat_header_link function in WP.
    Where did you get that?

  9. mollysummer
    Posted 9 years ago #

    I got this file directly out of the theme folder "default" that came with my wordpress install. I am using a different theme, so I've never seen this file before.

  10. mollysummer
    Posted 9 years ago #

    OK, I went to a totally clean WOrdpress folder and found the file, now I can get the page to display, except that what I want is for the posts to show up just as a list of titles and not as one post at a time.

  11. moshu
    Posted 9 years ago #

    To be honest, I am confused.
    I just searched the whole "default" theme directory on a very fresh download and there is no such thing as
    That must come from your own code...

  12. moshu
    Posted 9 years ago #

    OK, you have posted while I was searching :)
    1. How many posts - that's defined in your admin > Options > Reading
    1a. If you want different number of posts in different views, use a plugin:
    2. If you want only titles, you should edit your category template and remove the_content tag and/or anything you don't need.

  13. mollysummer
    Posted 9 years ago #

    we must have x-posted. I don't know where that code came from, you were right. Now I'm at the task of making the categories display links to posts instead of the posts themselves.

  14. mollysummer
    Posted 9 years ago #

    never mind! I'm so sorry I really should have spent more time nivestigating before I posted here again. I think I have figured it out.

    thank you so, so much.

  15. superjadex12
    Posted 9 years ago #

    Just wanted to say thanks mollysummer, for asking the question, and moshu, of course for answering it!

    This was exactly what I wanted to do, and you helped me accomplish that.

    Even though the question didn't get fully resolved I was able to go off of your advice Moshu.

    Just a note for others wanting to do this out there:

    Change the archive.php to category.php then edit the category.php to accomplish what you want. For just links, edit out the " <?php the_content(); ?> = the post content) " stuff as moshu stated.

    Also, note that the links you click on to go to the Post page will use single.php for its template (default theme)
    . Further editing of single.php will give you control over how each individual post page will look.

    And I also implemented the "other posts from cat" plugin by aliester ( dagondesign.com )
    to further increase navigability.

    Hope this helps.

  16. Maujor
    Posted 9 years ago #

    Hi all,
    Thank you! Great post!
    Based here I've created a template that display a custom category page.
    I'm having the following problem:
    I had have set up in the WP control panel a maximum of 5 posts displaying in the Blog's pages.
    I can't figure out how to show all posts in the custom page instead of the default 5 last posts.
    I'm using a category-#.php template.
    The custom page showing 5 posts (there is 25 and increasing!) is hosted at: http://www.maujor.com/blog/category/todas

    Many thanks for any help

  17. Maujor
    Posted 9 years ago #

    Change de if loop for this one:

    $posts = get_posts('numberposts=100'); /* display 100 posts per page */
    foreach($posts as $post) :
    <div class="post">
    <?php endforeach; ?>

Topic Closed

This topic has been closed to new replies.

About this Topic