The plugin was installed on a running site. How do we add the post categories into Toolset, so that the categories showup under the dashboard itself, rather than going into Posts everytime.
How can it be done.
I was able to create Post Types.
Now is it possible that I can set the post type to a particular category of Posts, so that any new post created in the Post Type A should get posted in Post category A only be default.
There are around 20 Category under Posts. Under each category, daily posts are added.
WHat I need is:
For each category that is there, I created a Post Type, which showed in the Dashboard.
Now for each Post Type, three options show up: All Items/ New/Category.
For example, I added a category Gold under Posts. Daily some posts are added to this category.
So when the editor selects Post Type Gold, the default category should be Gold, and the editor doesnot have to select the category again
Can you please show me how exactly you configure your post type and taxonomy with term as I will require to know the slugs of the taxonomy, taxonomy term and post type.
Assuming that, you have post type event and taxonomy event-type and term slug gold.
This is the example code - you can modify it as required.
The Post categories are: Grains, Oildseeds, Spices, Market Trends
In Tooltypes, I create a Post Type Oilseeds. Set it to Taxonomy Category and saved.
Under Admin Dashboard, Post Type Oilseeds appeared, with three options: All Items, Add New, Category.
Now when I add a new post under the Post Type Oilseeds, I have to select the Post Category Oilseeds again. I want that when a post is created under the Post Type Oilseeds, its default category should be Oilseeds, post under Post type: Market Trend goes by default to category Market Trend. I have created a Screencast for better explaination.
I have around 25 post-types. So for each post-type I add the code:
else if ( 'publish' == $post->post_status && $post->post_type == 'market-trends' ) {
wp_set_object_terms($post_id,'market-trends', 'category',true);
}
for each type (replacing with the acutal name)
Do I need to change anything in :
add_action( 'save_post', 'func_set_default_object_terms', 100, 2 );
else if ( 'publish' == $post->post_status && $post->post_type == 'market-trends' ) {
wp_set_object_terms($post_id,'market-trends', 'category',true);
}
for each type (replacing with the acutal name)
==>
Yes, you need to make sure you replace the correct post type slug and term slug with wp_set_object_terms().
Do I need to change anything in :
add_action( 'save_post', 'func_set_default_object_terms', 100, 2 );
==>
No.
I tried two types, and it was successful.
One issue is : three category slugs are in Hindi. Will function.php take hindi text or there is some other solution. The hindi slugs are:
जिंस-एक्स-रे , जिंस-रूझान, वायदा-बाजार, समाचार