How do I echo one or more than one category from a URL on the category.php page?
-
How can I PHP echo two categories just from the link clicked on the previous page? I want to list one or more categories on my category.php page.
If I use the link: /category/jp-sapporo/ (1 category), I can use
<?php single_cat_title(''); ?>
as it echos the first category but I sometimes need 2 or more categories to be echoed.This is the link I have /category/jp-sapporo+jp-gourmet/ (2 categories) as an example.
I’m using this to perfectly count the total number of posts in both categories
<?php echo ($wp_query->found_posts); ?>
. Now I just need to find some code to show the categories.I don’t want all the categories of every post listed. Just the ones from the URL query.
The page I need help with: [log in to see the link]
- The topic ‘How do I echo one or more than one category from a URL on the category.php page?’ is closed to new replies.