Is it possible to set/connect first custom post's taxonomy (values) to other custom post?
Just random and basic example to understand a little better:
First custom post: jazz concerts
Second custom post: places to crash/sleep for night
Both custom posts has it's own taxonomies and post_metas, for
example: location, price etc.
Now we need a connection between posts & taxonomies so that you find most nearest locations to crash if you are going to jazz concert - that can probably be done by WP_query & I got this.
I've never seen anything like that in stackoverflow or in WP docs. I tried but it was too long, complicated, didn't make any sense and generated infinite errors & I thought I ask before trying again, maybe someone has been dealing with this kind of situation.
Do I just need to name taxonomies and post_meta differently and get them to query same way as post's own taxonomy and post_meta? And all same from here?
How to get other post's taxonomy/post_meta dropdown box or other types of inputs to admin edit page?
I hope that I expressed myself clearly. If there's any confusion or questions, let me know & I'll provide additional information or explain something in more depth.
You can register a taxonomy against several post types: link in the second parameter of register_taxonomy() you can provide an array of post types. Those post types will then have the same taxonomy.
Related
I have an listing page on my WordPress site which outputs many different post types in alphabetical order based on the title of the topic taxonomy.
For example I have videos, pages, research, profile, abstract post types which all share the global taxonomy of topic. Within topic, there are such terms as Asthma, Bone, Cancer, Diabetes, Epilepsy, Gout etc. On my A to Z listing page, there will be a category A which would need to display all videos, pages, research, profile, abstract which have a topic taxonomy beginning with A such as Asthma, then a category B with all post types containing a topic taxonomy such as Bone etc.
I have no idea how to achieve this. Googling hasn't helped. I have tried a few variations of the tax_query I can get all the post types outputting with their topic taxonomy listed but I can't come up with a way to only output topic taxonomies beginning with A etc. I can achieve this with post title but I can't get it to work within a tax_query.
Any help would be greatly appreciated. Thank you.
After reading countless answers on various websites including Stack Overflow and trying different solutions, I think I am losing the will to live because I cannot seem to find a solution to my problem that works - even though many people seem to have solved it one way or the other.
I have the following Custom Post Types on my WordPress website:
CPT: cpt_business
Slug: cpt-slug
Slug Rewrite: mycptbase
with_front = false
and I have the following Taxonomy:
Taxonomy: tax_business
Slug: tax-slug
Slug Rewrite: mytaxonomybase
hierarchical = true
with_front = false
When I create a custom post titled Business Name in cpt_business Custom Post Type, the post has the following URL structure:
https://example.com/mycptbase/business-name/
I want the post to have the following URL structure:
https://example.com/mytaxonomybase/mytaxonomy-1/mytaxonomy-2/business-name/
In other words, I want my custom post type have the taxonomy's URL structure. The tax_business taxonomy is hierarchical, and can have up to 10 items - in which case, only the lowest item in the category tree is selected when creating the post.
I tried many, many different code samples. The closest to a solution I got was with the Custom Post Type Permalinks plug-in, however that insisted on keeping mycptbase in the permalinks - meaning my final URL ended up being /mycptbase/mytaxonomy-1/mytaxonomy-2/business-name/.
The second closest I got to a solution was the method described here, but with this one, it simply ignored the hierarchy in my taxonomy and only included the single taxonomy item selected.
I would genuinely appreciate if you can help me or point me in the right direction. Please note I am a total newbie when it comes to PHP and have a basic understanding of its role in WordPress.
It would be awesome if I can fix this problem by adding / amending a code in the functions.php file. I will give you a corona-free virtual hug if you can help me out.
Thanks a million in advance.
Having a little trouble here hoping someone can help. I've been reading around and can't seem to find what I'm looking for. What I have done so far is create a custom post type in Wordpress for a product which has two non-hierarchical taxonomies (colour and style).
I can display them fine but I want to be able to do is filter them via links in the sidebar. So you can just select products in certain colour AND certain style and it will display them. E.g if it was cars display all red cars in a saloon style.
Any ideas? Thanks.
The OTW Portfolio Light plugin can achieve what you're looking for. Kindly note that this plugin works only with the default custom post type that comes built-in with the plugin. (It is otw-portfolio, if I'm not wrong). You'll have to customize it suit your need.
My idea is to have a page where two authors can post multiple posts (in the page) and other visitors can comment the whole page:
I had in mind a very simple (hack) approach which is:
Having a custom "page" that has all the posts of a category and that page can be commented
Having a page where two people edit the content (but then the multiple posts are faked by being one page only being modified) and normal comments for the page
Use of taxonomies (which I am not very used to) and create a custom taxonomy where you can post and comment, any hint on this one?
Is there any better way of achieving this?
There's a great plugin for this: https://wordpress.org/plugins/pagely-multiedit/
If you don't want to use the plugin, you can carve out the functional code.
Let me know if you have any other questions/issues regarding this or if it doesn't fully solve your goal.
I’ve a question about Wordpress’ post and pages. I’m not new to Wordpress but this feature is a first for me and I can’t really seem to get my head around it.
The case is, that I have a parent page (focusareas) which has a number of static childrens (child01, child02, child03, etc.) These children are as mentioned static and do not change (or change very little over time) but the thing is that there will be some blog posts which are related to them – but the blog posts also have to function as an independent entity. Each blog post can have a number of comments, but the child01, 02, 03, … n subpages cannot have comments.
Is it possible to “connect” or “relate” a blog post to a page (subpage) and list them on the subpage?
I don’t know if I’ve explained it correctly but otherwise please let me know and I’ll draw a diagram or explain in further details.
Sincere
- Mestika
I think you need 2 things.
The first is use custom fields to store wich posts ( or category, or anything else ) is related to this page. http://codex.wordpress.org/Custom_Fields
The second is use get_posts loop, to "call" these posts inside other loop, with all his features: http://codex.wordpress.org/Template_Tags/get_posts