开发者 |
hypestudio
dejanmarkovic freemius nytogroup bamadesigner |
---|---|
更新时间 | 2019年10月15日 23:20 |
捐献地址: | 去捐款 |
PHP版本: | 3.1 及以上 |
WordPress版本: | 4.6.1 |
版权: | GPLv2 or later |
版权网址: | 版权信息 |
Good question. While CPT-onomies strives to mimic taxonomy functionality as much as possible, CPT-onomies are not stored in the database in the same manner as taxonomies. The simplest answer to "Why not?" is that I believe my current method of "not duplicating post information to resave as taxonomy information" is in the best all-around interest of not only my plugin, but also your web site. With that said, I am constantly searching for new ways to "hook" into WordPress to improve CPT-onomy/taxonomy integration and, when impossible, will continue to provide workarounds.
Another good question, with a very simple answer: the term ID. CPT-onomies return the same information as taxonomies, including a term ID. A CPT-onomy term's term ID is the same as its post's post ID.
This is a jQuery "bug" that only seems to plague a few. I've noticed that this validation standstill will occur if you have any text printed outside the <body>
element on your page. If that's not the case, and the problem still lingers after you've upgraded to version 1.1, you can dequeue the validation script by placing the following code in your functions.php file:
<?php add_action( 'admin_head', 'my_website_admin_head' ); function my_website_admin_head() { wp_dequeue_script( 'custom-post-type-onomies-admin-options-validate' ); } ?>
As of version 1.3, you can change the format for your meta boxes via the settings page! The following filter still works, though, so feel free to use as you please. It will overwrite the settings. If you have a hierarchical CPT-onomy, the default selection format is a checklist. But if you would rather use the autocomplete box, or a select dropdown, CPT-onomies allows you to hook into the meta box (via a filter) and overwrite the default selection format. Here's an example of the filter. More information, check out the "Help" tab in the CPT-onomies settings or visit the FAQ . `<?php add_filter( 'custom_post_type_onomies_meta_box_format', 'my_website_custom_post_type_onomies_meta_box_format', 1, 3 ); function my_website_custom_post_type_onomies_meta_box_format( $format, $taxonomy, $post_type ) { / * When editing a post with the post type 'movies', * we want to assign the 'actors' CPT-onomy terms with an autocomplete box. / if ( $post_type == 'movies' && $taxonomy == 'actors' ) { return 'autocomplete'; } // No matter the post type, we want to assign the 'actors' CPT-onomy terms with a select dropdown elseif ( $taxonomy == 'actors' ) { return 'dropdown'; } // No matter the post type, we want to assign the 'directors' CPT-onomy terms with a checklist elseif ( $taxonomy == 'directors' ) { return 'checklist'; } // WordPress filters must always return a value return $format; } ?>`
You also have to add theme support for post thumbnails to your functions.php file:
<?php add_theme_support( 'post-thumbnails' ); ?>
If FAQ didn't cover your problem, refer to the following resources: