Showing multiple categories on Listing Page


  • Gordon
    Newbie 4 points
    September 20, 2016 at 11:01 pm

    On my DT site, listings can be in multiple categories. I would like my listing pages to show all of the categories assigned to that listing. The only shortcodes I have found are [CATEGORY] which displays only one category (the first alphabetically), and [CATEGORIES] which displays every category on the site, including those to which the listing does NOT belong.

    I realize that the [FIELDS] shortcode includes exactly what I want, but it is limited to a table display and not right for my purposes.

    Thanks in advance!


  • Josh
    Super Guru 13,875 points
    September 21, 2016 at 1:35 pm

    Hello Gordon,
    Try the [CATEGORYLIST] shortcode

    This reply was awarded the best answer by the topic poster.

  • Gordon
    Newbie 4 points
    September 21, 2016 at 5:20 pm

    Thank you Josh! I didn’t find that in the documentation. For anyone who finds this in the future, the [CATEGORYLIST] shortcode produces a bulleted list, so I added some CSS to my Listing page customization to make it a paragraph of items in a series, separated by commas.

    <style>
    ul {
        list-style: none; /* Remove list bullets */
        padding: 0;
        margin: 0;
    }
    li {
       display: inline;
    }
    li:before {
    	content: ", "; /* Insert content that looks like bullets */
    	}
    </style>
  • Marie
    Marie
    Super Guru 1,818 points
    September 22, 2016 at 5:14 am

    Thanks for sharing Gordon.


  • Josh
    Super Guru 13,875 points
    September 22, 2016 at 12:30 pm

    Hello Gordon,
    Some shortcodes are missing from the documentation but Mark Fail is working on a new documentation to be released soon.Best way to check available shortcodes is by accessing the file class_shortcodes.php located in your theme files >framework >class


  • Gordon
    Newbie 4 points
    September 23, 2016 at 4:15 pm

    BTW – While the code above worked for my specific purpose, it also inserted commas before every menu item. LOL. I’m just going without commas for now until I beef up on my CSS. as follows:

    <style>
    ul {
        list-style: none; /* Remove list bullets */
        padding: 0;
        margin: 0;
    }
    li {
       display: inline;
    }
    </style>

  • Josh
    Super Guru 13,875 points
    September 24, 2016 at 2:07 pm

    Hello Gordon,
    Try the below code:

    
    <style> 
    .core_middle_wrap ul {
        list-style: none; /* Remove list bullets */
        padding: 0;
        margin: 0;
    }
    li {
       display: inline;
    }
    li:before {
    	content: ", "; /* Insert content that looks like bullets */
    	}
    </style> 
    

  • Gordon
    Newbie 4 points
    September 26, 2016 at 5:09 pm

    Thanks, Josh, for teaching this man how to fish! Very grateful!

    I took your suggestion and got the following to work:

    <style>
    .core_middle_wrap ul {
        list-style: none;
        padding: 0;
        margin: 0;
    }
    
    .core_middle_wrap li {
       display: inline; 
    }
    .core_middle_wrap li:before {
    	content: ", "; 
    	}
    </style>

  • Josh
    Super Guru 13,875 points
    September 27, 2016 at 2:18 pm

    Thanks for updating Gordon 🙂

  • Charles
    Charles
    Senior Member 149 points
    October 2, 2016 at 1:32 pm

    @Gordon and Josh. Thanks for sharing this!


  • Julien
    Newbie 14 points
    October 2, 2016 at 9:15 pm

    Hi

    Do you know if the theme is update with this problem?

    Thanks

    Julien


  • Josh
    Super Guru 13,875 points
    October 3, 2016 at 6:55 am

    Hello Julien,
    It was not a problem.Gordon was customizing the shortcode output


  • Sarah
    Newbie 15 points
    February 25, 2017 at 3:49 pm

    Thank you for this thread! I have added the code but I’m not getting the same results as you Gordon I’m afraid…..

    https://fun4thekids.co.uk/dir/listing-category/under-5s-groups-classes/

    The third result down for example is showing bullet points in a list not paragraphs.
    If anybody has any suggestions I would be very grateful


  • Sarah
    Newbie 15 points
    February 25, 2017 at 3:51 pm

    Fixed it, thanks once again for the information


  • Sarah
    Newbie 15 points
    February 25, 2017 at 3:54 pm

    Errr well it fixed the lovely multiple categories with commas which is what I was after but has added commas in the “sort by” options too!

    https://fun4thekids.co.uk/dir/listing-category/under-5s-groups-classes/

    Any suggestions?

Viewing 15 posts - 1 through 15 (of 17 total)

New Business Themes for WordPress 2020

Start your new website today!

View Business Themes