What is the best method for organizing geographical/city content in WordPress? - wordpress

I want to create a news contributor network similar to that of yahoo.com. It will have categories such as events, sports, fashion, etc but I want the content organized into different cities. However, I would like some content to have the ability of being shared across all cities. What is the best way to structure this or set this up in wordpress?

Without knowing your complete situation, one solution may be to have categories used for topical reasons (as you already have) and have tags used for cities.

Adding this after your latest comment.
One solution would be to register a custom taxonomy for Cities.
You could assign this taxonomy to default and any custom post types you have. This would function the same as Wordpress categories do and you could assign a city yo any post.
The advantage of this users could then view all post from a selected city.
https://codex.wordpress.org/Taxonomies
The Wordpress codex should have everything you need to get this set up.

Related

Connect one CPT to another CPT in a wp_query loop

I am looking for the most efficient way to create two separate custom post types called "venues" and "offers". The role of such would be to display on a website it in the following way:
VENUE_1
offer A
offer B
etc
VENUE_2
offer C
As you see, the venues will be quite static, once added photos and descriptions will remain the same. The most dynamic thing are offers. They will vary from each other. I know I can handle that through ACF repeater in a single CPT but I don't want to use this solution due to a few technical requirements.
Is there any way that Wordpress (or Wordpress +ACF) will allow to do that? From the flow pov it will look like that:
an editor adds venue, with descriptions, photos etc through venue CPT
along the time an editor adds specific offers through offers CPT, selecting via e.g. dropdown to which venue it is connected
I have never used relationship fields in ACF but afaik while selecting I need to do it fully manually and select very specific offer. And as said, I want to handle later on only offers, avoiding situation when constantly I need to add manually those via venue item.
You're probably over complicating things.
You should approach it from a taxonomy point of view, meaning,
venue as a taxonomy, offer as a custom post type.
You can use taxonomy-<my-taxonomy>.php to create a specific template for your custom taxonomy. eg: taxonomy-venue.php.
You will be able to access your venue through the following permalink example.com/venue/my-awsome-venue
On each venue taxonomy pages you will a custom query to loop through each offer which are listed under the currently queried venue.
You should read Template Hierarchy from the codex, to have a better understanding of templating.

Wordpress advanced taxonomy(category) filtering in post-types

I'm using Wordpress as an headless CMS/REST. For a post I got different kind of categories, these are divided by three main categories, each having other categories linked to one of these three parents. With the standard filtering options I found on the website.
What's possible now is to query a post and enter the category id of either of these sub-categories and it will retrieve all posts linked to them. What I'm trying to find is a way to query first posts that both have these sub-categories, instead of just all the posts that either have one of those. Second, (if it's possible) it can only query one sub-category of each the parent-category.
Hope it's a bit clear. What's possible now is that I can query all the posts linked to one categories, but I can't exclude them if they don't have the same one (and if it's possible, exclude choosing more then one sub-category of one main category).
If anyone has an idea how to do this by making a custom function or with a plugin, please let me know, thanks!

Category with children organization: wordpress

Good day kind crew. I haBe a issue. what I am trying to do is this: a tennis league with 5 divisions. These 5 divisions are located in everytown and those towns in states. I am using ACF and pods. On the state archive page. We would like to choose the state and then on the specific state page we would see the divisions terms. And when you click the division you see all post from that tterm. We have a custom template for the taxonomy but want to limit how many template pages we need to create. If we go with categories than we have to make a custom template for every town/division. Any suggestions on best logic for this making it easy to use on front end without losing admin organization. We set up category hiearcy but we're looking for a better way because we need to allow for user to fill out form and populate post. At this point we have decided to use categories unless someone has another option. Categories just feel sloppy on admin side with children. Thanks for your time.
I'm not sure I understand the question, and thus am not sure I'm on the right track with this answer.
I think you're looking for towns/divisions to have content that can be customized by users. There may be a more WP specific way to do this, but a simple way would be to have a db table with these elements associated with the post id, for example post_id, town_desc, town_mascot, etc. Then, in the WP template, run a query to see if custom elements exist. If not, echo some default text, otherwise echo the custom element text from the db. I think I'd also have the default text be different based upon the level, i.e. with states, divisions, and towns all different based on their level.
Your answer might lie in simply working with custom fields, perhaps with
https://wordpress.org/support/article/custom-fields/

What is the best way to organise my Wordpress Site content?

Interested to know the best way to use Wordpress for displaying various items where:
There are several Ranges (Styles) to choose from; then
Each Range contains several Collections; then
Each Collection contains several items; and
Each Item has tags.
My initial thoughts are use Categories for the Collections and Posts for items and each of the posts will contain tags to allow them to be searched. But how should I create the Ranges and place Categories under each Range? Do I assign two Categories and then filter them? or do I create a page for each range and then add a loop of posts to those pages and filter?
What is the best way to achieve this?
By way of an example, what I am trying to achieve could be seen as similar to this fashion example:
Ranges could be different Fashion Designers;
The collection could be Menswear, Womens and kids collections by that Designer;
The items are the individual clothes to buy, each available in different sizes, colours etc.
Thanks
To me this sounds like a good usage of custom post types (CPT) and custom taxonomies.
Thus you can add a CPT named clothing_item and attach certain taxonomies to it such as designer, collection, season and whatever else you can think of.
The advantage of this approach is the fact that you can still keep the default functionality of posts in case you decide to add a blog functionality to your site. Another advantage is that you can enable visualising the items across the different taxonomies. Say you have designers John A. Doe and John B. Doe. You could, by using taxonomies, see all the items from the menswear range of both designers, while if you had a child category called menswear for both of the designers you couldn't even if they were the same.
This applies best if you code your own theme. If not, you can still write your own child theme / plugin, or use an existing plugin to add this functionality.

Wordpress: custom post types: using custom fields or taxonomies?

I'm thinking about using WP custom post types to create a basic real estate website.
The post type will be for property listings. I've decided to have one post type for For Sale and one for Rentals, simple because they have somewhat different property information.
A typical listing will need to specify some information, ie, is it a house, an apartment or maybe it's just a piece of land.
What are the pros and cons of specifying this info using custom fields (meta data) versus using taxonomy (categories and tags)?
I can see that it's easy to search based on taxonomy, but custom post types meta data can also be queried.
Also, it seems that this question applies to any post data where discrete choices are required: meta data checkbox, select or taxonomy.
Any thoughts?
Thanks.
My preference for what you're trying to do would be taxonomy for the following reasons:
SEO and User Friendly URLs
With categories and tags, WordPress permalinks are setup to put that information in the URL for you. This will go a long way towards the SEO and usability of your site because you'll be able to create URLs like:
http://yoursite.com/rentals
http://yoursite.com/for-sale/two-bedroom/123-fake-street
Hierarchy
I don't know if you have the need for it, but building a hierarchy with categories is easy. This will give you lots of flexibility when it comes to organizing your posts.
Theme Coding
As you said, it's possible to perform custom queries for meta data, but WordPress has many out-of-the-box functions to query and display based on tags and categories. This will mean that you'll have to write less code to get your theme to do what you want.
I've done exactly what you are talking about, both ways (using Custom Fields versus Categories). My view is you should use a mix - use Categories for the most important information (eg For Sale, Type of Property etc) and use Custom Fields for the actual data for the listing.
Wordpress then has many built in functions to organise that data in a really intuitive way, and allows you to easily group properties of the same type together, in exactly the way a user wants to browse the data.

Resources