Get Site Category

Please can you tell me how to echo/get the current Site Categories?

Thank you

  • Gabe
    • The Bug Hunter

    Hey Stephan. Are you asking how to just list the categories? If so, there's no shortcode or anything that I can see. It's something you setup in the Settings menu:

    The Landing Page drop-down lets you select where the Blog Categories output listing will be displayed. This works similar to the Settings > Reading option on a normal site. You simply pick an existing page form the drop-down.

    Or are you asking for an actual echo/print PHP function to insert into a page template or something? I apologize if I'm misunderstanding.

  • Paul
    • The Green Incsub

    @stephanboehme1,

    So you are wanting template PHP code logic. The Site Categories are setup as a normal taxonomy within the primary site of the Multisite system.

    1. To get the sites associated with a specific Site Category term you can use the plugin function

    $sites = $site_categories->get_taxonomy_sites(XXX);

    Where 'XXX' is an integer for the Site Category term. The $sites returned will be an array.

    2. If you want to do something more direct you are welcome to use the WordPress get_terms function. If you do please use the global define SITE_CATEGORIES_TAXONOMY which is set when the custom taxonomy is created. Take a look at line 2180 of the site-categories.php main plugin file for example setup.

    There is not much else as far as hook as this plugin was pretty self contained. But let me know if you get stuck.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.