WordPress.org

Ready to get started?Download WordPress

Forums

Show all categories from URL in archives page? (2 posts)

  1. millett513
    Member
    Posted 1 year ago #

    I want my archives page to list the categories based on the URL. For example, if the URL is domain.com/category/red+blue+green, I would like it to say "Your Selections: Red, Blue, Green" at the top of the page.

    This is the code I have tried, but it only lists the first category and not all of them.

    <?php 
    
      $cat = get_category_by_path(get_query_var('category_name'),true);
      $current = $cat->cat_ID;
      $current_name = $cat->cat_name;
    
    echo "Your Selections: " .$current_name;
    ?>

    If anyone can tell me how to get it to list them all, it would be greatly appreciated!

  2. millett513
    Member
    Posted 1 year ago #

    Anyone have any ideas?

Topic Closed

This topic has been closed to new replies.

About this Topic