What about...a checkbox taxonomy! Whoo hoo! What an awesome idea!

I used CustomPress to create the Custom Post type "Courses."

Now I'm working on Taxonomies.

I want users to simply be able to check a box to indicate whether or not their course is Online.

So it would look like [checkbox] Are you holding your course online?

Then, on the site, when you hover over "Courses" in the Nav Menu, I want to see a child category that reads "Online Courses" which of course would show all of those courses that had been checked as online.

How do I do this?

Followup question:

Is there a better way to have Courses as a menu item instead of pasting in a link to the Course Archive page? I selected True for "Show In Nav Menus" but this just allows me to check boxes to say which courses I want in the menu. Which isn't exactly what I'm looking for.

Thank you all you awesome people!

  • DavidM

    Hi katypurviance and first off, welcome to WPMU DEV! Glad to have ya here!

    And thanks for your enthusiastic feedback! It sounds like both of these would require a somewhat similar solution involving customization of your theme's nav menu or functions.php file.

    Basically, you could add a new menu item to your theme itself that programmatically populates the menu with your custom post type Courses. The same bit of code providing that functionality could easily be used to filter the list based on your "courses online" checkbox.

    The checkbox itself could easily be accomplished by way of a custom field in CustomPress, with the custom field section being accessible as follows:

    To get a list of your custom post types you can refer to the following:

    And apart from hard-coding a menu item in your theme, there's also a pre-filling method described in the following (excellent) resource:

    If this seems a bit technical, it may be something you'll want to seek a developer's assistance with. Though the 2 links I just mentioned could somewhat be combined to achieve this result.

    Hope that helps!


  • katypurviance

    Thanks David!

    While the idea of getting a developer is tempting, I really want to learn how to do this.

    So for the code example from http://codex.wordpress.org/Function_Reference/get_post_types#Output_a_named_post_type:
    'name' => 'property'
    $output = 'objects'; // names or objects
    foreach ($post_types as $post_type ) {
    echo '<p>' . $post_type->name . '</p>';

    I would replace "property" with "courses" ...right?

    And then I would insert this code...where?

    And this will hard code "Courses" as a menu item...right? Which, when you click on it, will take you to a page listing all of the courses...right?

    I made the checkbox --thanks for the guidance! But how do I make those courses that were checked show up as a sub of Courses on the Nav Menu?

    I'm a little confused by http://wp-snippets.com/954/pre-fill-a-custom-menu/ Is this showing me how to create a menu from scratch...instead of using the WP 3.0 menu?

    So many questions. I greatly appreciate the education! :slight_smile:

  • katypurviance

    Hmmm....So I followed the instructions here https://premium.wpmudev.org/project/custompress/installation/ to add my custom field.

    And I got my test post (with its check box checked) to display "Online."

    However, I was really hoping for it to be clickable to a page of all the Online Courses.

    I think what I really need is for this to be a taxonomy instead of a custom field.

    So, is there a way to do checkboxes in taxonomies? (Almost like a Category all by itself)

    Or, is there a way to make this one custom field clickable?

    Or maybe there's a completely different way to do this?

    What's the best way to do this?

    Many thanks!