Viewing 6 replies - 1 through 6 (of 6 total)
  • Theme Author Tom

    (@edge22)

    Hi there,

    So you want your parent category pages to display links to each of your sub-categories?

    You’d likely need to create custom page templates in order to do that.

    Alternatively, you can create static pages and include links to your sub-categories within them. Then you can add the static pages to your menu.

    Thread Starter revivalz71

    (@revivalz71)

    Hello,

    Yes, i want my parent category page to display a link for each subcategory i don’t want the parent category page to display post of the parent category or subcategory, but i still want my subcategory page to display the post of the subcategory.

    I tried to use a page to replace my parent category page, but it did not work as expected, that’s why i would rather make my parent category page to stop display the post but instead display a link to each subcategory, i hope you understand.

    • This reply was modified 7 years, 4 months ago by revivalz71.
    • This reply was modified 7 years, 4 months ago by revivalz71.
    • This reply was modified 7 years, 4 months ago by revivalz71.
    Theme Author Tom

    (@edge22)

    Is there a particular reason the static page method didn’t work for you? Might be something we can figure out.

    If not, there might be a plugin out there that can accomplish it. Otherwise, we’d need to create a custom template file to change the way the normal category pages work.

    Let me know 🙂

    Thread Starter revivalz71

    (@revivalz71)

    Hi,

    The thing is that if i use page instead of category, it mess up all the url structure of my post.

    That’s why i would rather use category, i just want my parent category to show the subcategory instead of the post.

    Thank you

    Thread Starter revivalz71

    (@revivalz71)

    If it’s too hard to do, then just disabling the post on the category page would do it, i will then, manually add the subcategory to the parent category.

    Theme Author Tom

    (@edge22)

    In that case, you’d need to add a child theme to your site: https://docs.generatepress.com/article/using-child-theme/

    Then you’d need to copy the archive.php file from the parent theme, and add it to your child theme.

    If you only want to apply these changes to categories and not other archives, you’ll need to rename the file to category.php.

    Then, to remove the default posts, you’d need to remove this chunk of code: https://github.com/tomusborne/generatepress/blob/2.2.2/archive.php#L24-L52

    In its place, you’d need to place a custom query which only gets sub-categories. Something like this might help with that: https://wordpress.stackexchange.com/questions/13485/list-all-subcategories-from-category

    Let me know 🙂

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘category/subcategory’ is closed to new replies.