WordPress tax_query taxonomy starting with particular character - php

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.

Related

Custom post's taxonomy set to other custom post?

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.

Wordpress custom post type filtering

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.

Wordpress: two types of comments? or multiple taxonomies?

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.

Wordpress - Make category.php list posts from subcategories as well

I'm building a blog where three people will be writing, but they will have a separate section on the site. The structure is built upon categories and looks like this:
User one
Clothes
Fashion
Life
User two
Family
Life
User three
Family
Friends
Life
I've set all three users as writers and used the plugin Restrict Categories in order to lock their categories to the sub-categories the matching each top level category.
Now here comes the question, if I visit http://site.example/category/user-one/ I want to have a listing of all the posts, including the sub-categories since there will be no actual content in the top level category that you are browsing.
I've tried making this using filters bound to pre_get_posts but I still can't get it to work. Does anyone else here have any ideas?
I've also given some though into actually creating a multisite network for the purpose, but I then realized it will be hard to fetch posts from all the networks at once.
Thanks in advance, Jonathan
#Jonathan: Not sure if I am misinterpreting what you are hoping to achieve, but given that each author will already have their own 'author' page which lists all their posts (if your theme includes this or something you could create or customise), there may not really be a need for Users 1-3 to be their own category?
Going back to your question, for listing subcategories, perhaps https://wordpress.stackexchange.com/questions/13485/list-all-subcategories-from-category might be of some help.
As for listing posts, to keep things simple, I reckon you might be able to use e.g. get_posts (http://codex.wordpress.org/Template_Tags/get_posts) and build custom arguments, perhaps in a loop if you prefer to use one instead of slug/id specific category templates.
http://codex.wordpress.org/Category_Templates
If it's any help, Bainternet actually created a plugin that makes life a little easier to define category templates: http://wordpress.org/plugins/custom-category-template/

Wordpress: Relate blog post to a (sub)page?

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

Categories