Site icon StartFunction

How to use custom taxonomies in TDO Mini Forms

TDO Mini Forms is one of the best plugins for WordPress to allow visitors or users to publish posts and upload files without having to access the admin area. You can select categories for the post, add tags, title, content, etc. However, even after WordPress introduced UIs for custom taxonomies in version 2.8, TDO Mini Forms (or tdomf for short) won’t allow you to select custom taxonomies. In this post you will find how to modify the categories widget for TDOMF to enable custom taxonomies.

First of all, I should warn you to test it throughly first in a local WordPress installation and only then upload it on your live site. I’ve try my best to test it extensively but I cannot guarantee that it will work 100% ok. However, both categories and custom taxonomies (both hierarchical and those that are not) are being correctly saved. If TDOMF supports custom taxonomies later, it will just work, as this mod doesn’t add any strange stuff other than canonical WordPress functions to support the custom taxonomies.

  1. Ok, so the first step is to download TDOMF. Install it and activate it on the plugins area.
  2. Now go to the plugin’s folder. Open the widgets folder and locate the file tdomf-categories-widget.php.  The full path should be yoursite/wp-content/plugins/tdo-mini-forms/widgets/tdomf-categories-widget.phpIf you want to keep it as a backup, cut this file and paste it outside of the widgets folder.
  3. Download the modified widget that supports custom taxonomies
  4. Decompress it in the widgets folder. That’s it, you can go back to your admin and create a form. If you’re new to TDOMF, you might find the installation and usage instructions useful.

After you set up the options for your form, enter Form Creator.

Select the number of widgets that you want. At least two, one for the regular WordPress categories and one for your custom taxonomy. Click save. Now drag the two widgets from the Available Widgets block to the Your Form block.

We are now going to tell TDOMF to use our custom taxonomy. Access the Categories # widget properties and set the Taxonomy Slug to your taxonomy name. By default, the widget will contain category as the taxonomy slug, that is, the standard WordPress Category taxonomy.

For instance, if you created your custom taxonomy with:

[php]

function register_taxonomy() {

register_taxonomy(
‘color’,
array( ‘post’ ),
array(
‘public’ => true,
‘labels’ => array(
‘name’ => __( ‘Colors’ ),
‘singular_name’ => __( ‘Color’ )
),
‘hierarchical’ => true,
)
);
}

[/php]

The taxonomy slug will be color. Set the other options like with the usual TDOMF Categories Widget. After you set the values you can preview your form on Your Submissions. For instance, I’ve set the categories to be displayed as checkboxes.

So that’s pretty much it, now you have custom taxonomies for TDO Mini Forms. Keep in mind that this is a temporary fix, it won’t be long until TDO Mini Forms will support custom taxonomies but again, with this modified widget the categories and custom taxonomies are saved in the regular WordPress way so they will still be there when TDOMF is updated.

Exit mobile version