How to create a directory

Hi There,

I would like to create a directory/listing of blogs based on their site category(ies) and/or sub category(ies). For example, I have a course that I am running ( that is a sub-site under the main MU site This course has multiple student sections. What I would like to do is use the site categories plugin to classify the student blogs by course (site category) and section (sub category) then list them by sub category on this page:

Would someone be able to assist me in how I can get started with this using the site categories plugin? I have some basic php knowledge....


  • Paul

    @jcode, First off LOVE the name. Then again I like anything with the word 'code' in it.

    Like Joe, I'm also trying to understand what you are asking. I've looked at your site and into some of the courses Blogs. So for example and From the Blogs listing I see they link to a specific section of your system From what I can tell these like your courses are setup as individual sites within your Multisite system (correct me if I'm wrong).

    Since each Blog is a site you should be able to assign Site Categories to theses. I would start with two top-level Site Categories or 'Courses' and 'Blogs'. Then within each setup the needed sub-category classifications.

    As for displaying the Site Categories as you are probably aware the plugin uses a 'landing' page you select on the main site. This may not suite your needs since I'm assuming you want to display the list of blogs dynamically in other sites.

    So I guess that bring up a question to you and a stopping point for me. How/where do you see displaying the list of blogs?

  • jcode

    HI @paulm and @aecnu,

    Thankyou both for your help. I really appreciate it!

    The way the sites are set up are as follows:

    Main edtech program site: Blog ID 1:
    Course site/blog: Blog ID 37:
    Student blogs:

    Students can potentially belong to any number of courses (i.e. edci336, edci337 etc.) so it made sense to make them blogs off of the main site but under /students/xxx (I hacked the .htaccess file to allow me to create nested paths hence the /students/xxx and /courses/xxx)

    What I want to be able to do is categorize the student blogs (and others) into sections - as we actually have >100 students enrolled in edci336 - but they are in different sections (A01, A02, A03, A04). I want to then be able to create a 'custom landing page' here:

    That will display the categories i create for each edci336 section i.e. edci336-A01-Fall2012; edci336-A02-Fall2012...etc as examples.

    So what I am asking, then, is how can I pull specific categories (or sub categories) of blogs from the wpdb? If this is not the right plugin should I use the 'Blog Type' plugin? This one just seemed a little more robust and scalable because as time goes on we will have a large number of courses and student blogs to categorize (where each student blog could be categorized to a number of different courses).

    I hope this was clearer.

    Thanks again for your help!


  • Paul

    @jcode, I would recommend sticking with Site Categories since I know this plugin from the ground up. I've not used or reviewed the Blog Types plugin.

    So you mentioned you have some coding experience. Well you will need it. Actually it should be very easy. I'll try and guide you. In Site Categories we register a new Taxonomy for the site categories. This taxonomy is only used on the Multisite main blog.

    Best place to start is to look at one of the Widgets. Probably the widget to display the site for a given category. /plugins/site-categories/lib/widgets/class_site_categories_widget_category_sites.php. Start around line 175 with the 'widget' function. You can see where it pulls in the global $site_categories object. Loads the config, Then line 186 or so switches to the main blog so that it can call the site_categories function 'get_taxonomy_sites'.

    The other widget code is used to display all the categories.

    Probably best to start thinking on a page template to create your custom landing page. I did at one point want to use a shortcode for the landing page. This would work for your needs. But there are some rewrite rules associated with the landing page that don't work well with the shortcode.

    Anyway start reading through the code first. Then lets keep this thread going with the development discussion.

  • jcode

    Hi @PaulM,

    I am afraid I reached the limits of my understanding of PHP. May take me a bit to get up to speed.

    I have come up with an alternative solution, though as follows:

    1) Each student in each section has been assigned to a particular user profile (created using the User Role Editor plugin: I did this because we also needed a way to classify the students in the back-end by course section.

    2) Using the Members List plugin ( I was able to create 'lists' of students to display on a page.

    The only drawback is the 'lists' using this plugin aren't updated dynamically but this will work for the time being while I figure out the site categories plugin. The site categories would be ideal because eventually students can belong to several different 'categories' or 'sub-categories' and having a good way to create this kind of site directory would be best.

    I will continue to play around with site categories......


Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.