• opneswestsussexwebsites

    (@opneswestsussexwebsites)


    I have just installed Custom Taxonomy Sort. Whilst the Order box appears in the add and edit screen for tags and categories, it does not appear in either the add or edit screen of a custom taxonomy that I have set up for a custom post type (wp-admin/edit-tags.php?taxonomy=mycustomtaxonmy).

    Is there any thing that I need to do to make this work.?

Viewing 11 replies - 1 through 11 (of 11 total)
  • i would ask how you set up your custom taxonomies.

    i set mine up in my theme’s functions.php file, i know that
    some other ways are easier but they can be error prone and
    incompatible with the native taxonomy system.

    it’s working fine for me, so i have to assume you did
    something differently.

    Thread Starter opneswestsussexwebsites

    (@opneswestsussexwebsites)

    It is set up in a child theme of a Woo Themes Parent Theme.
    It is set up in the child theme’s function.php file. I have also tried setting it up in the parent theme’s functions file, but to no avail.

    I am declaring it as follows within the same function where I am registering a custom post type to which it belongs:

    $labels = array(
    ‘name’ => ‘My Custom Taxonomy’,
    etc
    );

    $args = array(
    ‘hierarchical’ => true,
    ‘labels’ => $labels,
    ‘show_ui’ => true,
    ‘query_var’ => true,
    ‘rewrite’ => array( ‘slug’ => ‘mycustomtaxonomy’)
    );

    register_taxonomy( ‘mycustomtaxonomy’, array( ‘mycustomposttype’ ), $args );

    and using the action hook ‘init’.

    does it show up under posts, and allow you to add terms as “Categories” does?

    this is the way i did it, similar though laid out differently, and
    i registered each type individually.

    function build_taxonomies() {
    register_taxonomy( 'equipment-type', 'post', array( 'hierarchical' => true, 'label' => 'Equipment Type', 'query_var' => true, 'rewrite' =>  array( 'slug' => 'equipment-type' ) ) );
    register_taxonomy( 'location', 'post', array( 'hierarchical' => true, 'label' => 'Location', 'query_var' => true, 'rewrite' =>  array( 'slug' => 'location' ) ) );
    register_taxonomy( 'condition', 'post', array( 'hierarchical' => false, 'label' => 'Condition', 'query_var' => true, 'rewrite' =>  array( 'slug' => 'condition' ) ) );
    register_taxonomy( 'price-range', 'post', array( 'hierarchical' => false, 'label' => 'Price Range', 'query_var' => true, 'rewrite' => true ) );
    register_taxonomy( 'year-range', 'post', array( 'hierarchical' => false, 'label' => 'Age of Equipment', 'query_var' => true, 'rewrite' => true ) );
    }
    add_action( 'init', 'build_taxonomies', 0 );
    Thread Starter opneswestsussexwebsites

    (@opneswestsussexwebsites)

    It now works.

    I have created a seperate function to register the taxonomy and that has done the trick.

    So I think the proble was where I was registering the post type and taxonomy within the same function.

    Many thanks for your help.

    no problem ?? glad i could…

    Glad this is now working for you! Let me know if you experience any other problems with the Custom Taxonomy Sort plugin and I’d be happy to help you out.

    I had a similar problem to the above. I was registering the taxonomy in its own function inside a class that I instantiate on init and the Order fields weren’t available. Pulling the register_taxonomy out into functions.php solved the problem.

    I think the main issue here is that you need to use WordPress’ hook system to run the function that creates the taxonomy. By calling the function that registers the taxonomy on the ‘init’ hook.

    In the plugin, Custom Taxonomy Sort looks for the taxonomies that are registered at the time that the ‘init’ hook is executed. Custom Taxonomy Sort calls a function that will loop through each taxonomy and add the form fields to them. If your function that registers the taxonomies is run after ‘init’, the Custom Taxonomy Sort does not know that it exists yet and that taxonomy is not affected.

    So, the best form for adding taxonomies that will work for the Custom Taxonomy Sort (and really best form for adding taxonomies in general) would be something like (and I’m stealing this from the Codex):
    [Code moderated as per the Forum Rules. Please use the pastebin]

    New release of the plugin is available that will likely help with this problem. I found an issue that might have contributed to these problems happening. Download and see if it fixes the problem.

    Still problematic.

    @jtwg – I would be happy to help you sort this out. Your post about 1 month ago suggested that you have solved the problem. It now seems that there is an additional issue. Can you tell me more about what is not working? I will only be able to help you if I know more about what is occurring.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Custom Taxonomy Sort – Not Working on Custom Taxonmies’ is closed to new replies.