WordPress.org

Ready to get started?Download WordPress

Forums

Advanced Custom Fields - Taxonomy Field add-on
[Improvement] Output like normal taxonomy (3 posts)

  1. Beevelop
    Member
    Posted 2 years ago #

    Hi,
    thanks for this plugin. It's very usefull, but i dont like they way, the taxonomies are shown up. Why don't u use the standard behavior of viewing a taxonomy-metabox, instead of listing them with loosing the structure (subcategories by using a hierarchical taxonomy)?

    I looked up your code and one line does the trick (@line 178 following):

    //Hierarchical listing (like the category of posts)
    post_categories_meta_box(get_post($num = get_the_ID()), array('taxonomy' => $field['taxonomy']));
    //or Tag-like view
    post_tags_meta_box(get_post($num = get_the_ID()), array('taxonomy' => $field['taxonomy']));

    I tested this one and it seems to work... What do you think about?

    Greetings Maik

    http://wordpress.org/extend/plugins/advanced-custom-fields-taxonomy-field-add-on/

  2. Goudie
    Member
    Posted 1 year ago #

    Hi Slubbix,

    I don't have experimented your code but I am wondering if you have encountered errors, and above all, if it adds the ability to directly add terms?

    Thanks !

    Edit: just back from the topic created by ron_dev, where I find that you code add the text input ! Very good ! :)

  3. Beevelop
    Member
    Posted 1 year ago #

    The above snippet acts like a normal WordPress-Taxonomy, but i encountered a bug. You have to have at least one Tag-Taxonomy-Metabox on the Edit-View to have the js-functionalities (expand the most used, add,...) working. Btw. if someone is interested in my final implementation:

    public function create_field( $field ) {
    	$this->set_field_defaults( $field );
    
    	$terms = get_terms($field['taxonomy'], array('hide_empty' => false));
    	$value = $field['value'];
    
            $arr = get_taxonomies(array('name' => $field['taxonomy']), 'objects');
            if($arr[$field['taxonomy']]->hierarchical) {
                post_categories_meta_box(get_post($num = get_the_ID()), array('args' => array('taxonomy' => $field['taxonomy'])));
            } else {
                post_tags_meta_box(get_post($num = get_the_ID()), array('args' => array('taxonomy' => $field['taxonomy'])));
            }
    }

    (From Line 172)

    Greetings Maik

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.