• Sorry if this is so obvous.
    1/ I want to display all my categories regardless of whether there are posts in them
    2/ Any ideas on how to place a categories listing in a Page so it is like a “directory” ?
    Thanks heap for the tolerance

Viewing 6 replies - 1 through 6 (of 6 total)
  • 1) <?php wp_list_cats('hide_empty=0'); ?> or if you have/need other parametres, you can add that to the end of the list as &hide_empty=0
    2) For that you EITHER need a plugin for using PHP in posts and pages, for example PHP Exec OR make a page template that you use for a new page you create. Then just use the function call shown in #1. ??

    Thread Starter Murry

    (@murry)

    Hey thanks Mina,
    Where do i place the php for (1) – in the “template-functions-category.php”
    or in the “sidebar.php” of my theme.
    Sorry to be dense – Ive only had WP for 1 day but am having fun finding all the doorways ??
    Cheers

    Template-functions-category.php is a core file for WP — don’t touch it! ?? Anyway, sidebar.php sounds like a good idea to me

    What about the “directory page” you were planning?

    Thread Starter Murry

    (@murry)

    Chuckles – a mad idea I had.
    I thought I’d try to place my cats into a page so it had a “directory” feel to it. What Im fiddling with is less bloggish.
    Between the hint you gave and another recent post – I think I see a way – but Im still too green learning how to drive WP. Im still at the rip apart template stage and getting a clear idea of what I need.
    Im trying for a cms feel with the advatage of the blog on the side.
    Thanks.

    A simple page template (in a file called, say, categorydir.php — as long as it’s not category.php — that you’ve put in your theme directory) for your category directory could be something like this:

    <?php
    /*
    Template Name: Categories
    */
    ?>
    <?php get_header(); ?>
    <h2>Archives by category</h2>
    <ul>
    <?php wp_list_cats('hide_empty=0'); ?>
    </ul>
    <?php get_footer(); ?>

    You can see another template (archive, page, single…) for reference. Depending on the structure you may need to call get_sidebar to, I just happen to call it in the footer.

    Then, you’d make a new page and use that template for it (there’s a drop down list in Page Options, under the text area). You only need to give the page a name and save (no content).

    If you have lots of categories, a separate page for them is in my opinion a good idea. Not a mad one ??

    Thread Starter Murry

    (@murry)

    That was brilliant – thanks.
    I had already started pretty much that way but now I dont have to make so many mistakes ??

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Show all categories questions’ is closed to new replies.