• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

How can I add list of Categories in a page?

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › Design Tips and Tricks › How can I add list of Categories in a page?

This topic is: resolved

Tagged: custom page, php, post snippet, the loop, wp_list_categories

  • This topic has 4 replies, 2 voices, and was last updated 9 years, 8 months ago by Toby39.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • October 28, 2015 at 2:00 pm #169387
    Toby39
    Participant

    Hi folks,
    I am trying to automatically add a list of all Categories in a single Page.

    I have recently been able to make a custom Category page, that lists all the pages assigned to the one category. I added the following code inside a blank doc called category-categoryname.php :

    <?php
    
    // The Loop
    while ( have_posts() ) : the_post(); ?>
    <h4><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h4>
    
    <!--<div class="entry">
    <?php the_content(); ?>
    </div>-->
    
    <?php endwhile; 
    
    else: ?>
    <p>Sorry, no posts matched your criteria.</p>
    
    <?php endif; ?>

    I now wish to add a list of all Categories inside a page.
    I am using a plugin called "Post Snippet" to add PHP to the page using a shortcode.
    However, I am not sure what PHP to add to the Snippet.

    I assume that I will have to write a variation of The Loop, above – though relevant to Category titles instead of Page titles.

    Any help would be appreciated.

    October 28, 2015 at 8:34 pm #169420
    nutsandbolts
    Member

    This should display all the categories in alphabetical order:

    <?php wp_list_categories( 'sort_column=name&title_li=' ); ?>

    Hope that helps!


    Andrea Whitmer, Owner/Developer, Nuts and Bolts Media
    I provide development and training services for designers • Find me on Twitter and Google+

    October 29, 2015 at 8:32 am #169477
    Toby39
    Participant

    Hi Andrea, I removed the opening and closing PHP commands for use in the plugin "Post Snippet".
    It works fine.

    I'll continue to experiment with wp_list_categories to see if I can change the way they're displayed.

    Many thanks 🙂

    October 29, 2015 at 8:33 am #169478
    nutsandbolts
    Member

    No problem! I’ve marked this topic as resolved for now, but feel free to open a new topic if you need help with anything else. 🙂


    Andrea Whitmer, Owner/Developer, Nuts and Bolts Media
    I provide development and training services for designers • Find me on Twitter and Google+

    November 2, 2015 at 9:55 am #169868
    Toby39
    Participant

    OK, thank you

  • Author
    Posts
Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘How can I add list of Categories in a page?’ is closed to new replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2025 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble