Wordpress Template/HTML Question

Discussion in 'HTML & Website Design' started by leeannax, Jan 4, 2013.

  1. #1
    On my site at www.pricecharmer.com, when clicking on the "Categories" page, is there a way that I could have all of my categories automatically populate onto the page and the associated links? I have a "Categories" widget on the right sidebar, but I'd like to have these shown on the page as well.

    I like this PinBlue template, but I guess it's not the ideal template to use for my site.... either way, I'd like to keep working on it and tweak it, if possible.

    Any insight would be appreciated.

    Thanks!
     
    leeannax, Jan 4, 2013 IP
  2. Hefaistos

    Hefaistos Active Member

    Messages:
    194
    Likes Received:
    14
    Best Answers:
    9
    Trophy Points:
    63
    Digital Goods:
    1
    #2
    Yes, there is a way. (maybe this is not the only one).

    You can make a template for categories page.

    So, to do this you will need to create in the root of your folder theme a new php file.

    Let's name this eg. template-categories.php .

    First of all you need to tell WordPress that this is a template file. To do this, just place a comment like this at the top of the file:

    
    <?php
    /*
    Template Name: Categories page
    */
    ?>
    
    Code (markup):
    Inside this php file you need to include header, footer , sidebar and what you want to be displayed for that page.

    (Eg. Wp mode to include them with
    get_header();
    Code (markup):
    ,
    get_footer();
    Code (markup):
    , and
    get_sidebar();
    Code (markup):
    You can get inspiration by other files already included in your theme, like author.php, archive.php, search.php , ... )

    To display a list of categories you can use WordPress wp_list_categories() function.


    So , you will need to use wp_list_categories into your page to display a list of categories:

    <?php wp_list_categories('orderby=name&show_count=1'); ?>
    Code (markup):

    Use show_count only if you would like to display post counts for each category.

    To use your new created template, just create a new page from Wp admin page and choose from the right sidebar the name of the template that you newly created to be used for that page.

    Later you can style more this page. :cool:
     
    Last edited: Jan 4, 2013
    Hefaistos, Jan 4, 2013 IP
  3. leeannax

    leeannax Greenhorn

    Messages:
    33
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    18
    #3
    thanks for your help! I'm going to have to read up on how to do all of that, but I'll get there eventually.
     
    leeannax, Jan 4, 2013 IP
  4. jprawlins

    jprawlins Peon

    Messages:
    16
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Does your theme have widgets enabled in your sidebar? if so, there's a widget that you can use that'll do that for you (very easily).

    It's under the appearance section. BUT The theme has to have it enabled. Most do, but some don't.
     
    jprawlins, Jan 7, 2013 IP
  5. leeannax

    leeannax Greenhorn

    Messages:
    33
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    18
    #5
    Yes, I have widgets enabled in my sidebar. What widget can create a categories layout in my menu? That'd be great if it could do that.

    I finally figured out and did what Hefaistos instructed me to do above. I need to style it better when I have time, though. It looks sloppy. I need to figure out a better layout for categories in general.

    Thanks for your input!
     
    leeannax, Jan 9, 2013 IP