WordPress.org

Ready to get started?Download WordPress

Forums

Showing categories just for a certain page. (2 posts)

  1. cacahuete
    Member
    Posted 1 year ago #

    To make things short... my problem is that I want certain categories to show up for a certain page and not for all.

    My site contains these pages: Home, articles, about, contact
    Now the About, contact and the home page are static, articles not and therefor I have a couple of categories under them. I want them to show up just for ARTICLES, how do I do that?

    Thanks a million, a gazillion!

  2. Noumaan Yaqoob
    Member
    Posted 1 year ago #

    you need to create a template for articles page.

    Copy the contents page.php from your current theme and create a new file page-articles.php with these contents.

    artilces is the slug for your articles page. you can also replace it with page id like this page-10.php

    in page-articles.php before or after the post content paste this code where you want categories to be displayed. I assume that you want comma separated categories below each article or may be after the article title:

    <?php echo get_the_category_list(', ',' '); ?>

Topic Closed

This topic has been closed to new replies.

About this Topic