Category with children organization: wordpress - 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/

Related

What is the best method for organizing geographical/city content in 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.

Views and Categories...?

it's about this page: http://veagues.com/
Hey guys,
I've made a block-view with drupal that let's me sort my videos by a certain category, in this case "funny","epic","plays", "contest"...
The problem is: When you sort it by the certain category and click on a video and continue to click the "next" button, you will go threw all videos, instead of only the videos of the category...
My Question is: How can I put a filter on the nodes when i apply another category on the bottom block?
Thanks already!
If you're using Views, you should be able to filter the main block by the same taxonomy term.
Try adding a Contextual Filter to that block too. If there's a taxonomy term ID in the URL the block gets filtered by that Term ID and if there's no result, the block shows all the videos.
EDIT -----------------------------------------------------------------------------------------
You may need to try & understand what goes on when you make a selection in Drupal.
1/ The taxonomy term page will list all the content affixed with a specific term. The term tid can be seen in the URL, unless an alias have been created. A block can retrieve that term id, whether there is an alias or not.
2/ The node page will give you access to a specific node, but any block on that page should be able to access the term id of that specific node.
If you know where you are, it becomes easier to retrieve the info you're looking for. On the other hand, you may have to reconfigure a specific page in order to add the necessary extra block...
That can be done with templates but you could also have a look at Panels.
The Panels UI makes it easier to configure the page you're looking for without having to mess with code or templates, or both.
There's a lot of free video tutorials out there, search for Views & Panels.
If you want to have a look at preprocess functions, you will definitely need to download the Devel module...
...but have a look at these sites first:
http://codekarate.com/
http://drupalize.me/
http://buildamodule.com

Drupal sections division

I'm doing an intranet for a company that has multiple projects going on internally.
The idea is that each project has only 3 distintive things: its homepage, a small theme variation and its posts. Everything else is shared: every user can post into every section, it's just a way of visually dividing information.
Each project will have a path:
[...].com/projects/project1
[...].com/projects/project2
[...].com/projects/project3
My initial idea is the only 2 content types to have an extra (select type) field which is SECTION. Then, I make a .tpl for each homepage with the variations and calling the views that filter posts by this SECTION field.
This would would work but I'm missing 2 aspects: will I be able to use the section field value in the path auto module? Say I post a node with "corporate" as SECTION value. Will I be able to make it to [...].com/projects/corporate/post-title ?
Second issue is I don't know how to make [...].com/projects/corporate/post-title to load the theme for the "corporate" SECTION
Is my SECTION field approach right or is there a better solution? If anyone know an answer here or article somewhere that addresses this scenario please just point me to it.
Organic groups may be somewhat of an overkill but it could work http://drupal.org/project/og

dynamic WordPress custom meta boxes

I'll try and give an example what i want:
(this isn't what I'm doing, but it seems like a decent example of how I'd like it to work)
Imagine we have a custom post type (CPT) of 'houses' and one of the custom meta options for this CPT is 'bedrooms' - obviously, different houses have different amount of bedrooms, all of which have different properties. So, I'd like to be able to allow the user to add several different properties about a bedroom i.e.
Dimensions, aspect, number of windows and floor type
When the user has added these details for the first bedroom, if the house has a second bedroom then I would like them to have an 'add bedroom' button and another set of these meta boxes is added so they can fill out the details about bedroom 2.
I understand that I'll need some javascript to add this facility (and something I don't mind writing) but what I'm struggling with in my poor, useless brain is how to save these to the database. I want to achieve this using WordPress meta so that I don't add any unnecessary database tables and I'm sure it's possible I just can't quite fathom the principles of how to save the data.
Pointers to any tutorials would be brilliant, or some examples of plugins which already do this kind of thing would be very gratefully received.
here is a screenshot to get an idea what i want to do.
Solution:
I have found solution here, it might be helpful for someone.
https://wordpress.stackexchange.com/questions/25478/custom-post-type-metabox-array
You are basically after repeater metaboxes. A few metabox classes support repeating fields. One worth checking out is http://www.farinspace.com/wpalchemy-metabox/
I wrote a plugin that uses repeating metabox fields that doesn't use wp-alchemy if you want to dig through it. http://code.google.com/p/css-thumbnail-sprites/

Drupal: Content in blocks from node_reference fields?

After only a few weeks of working with Drupal I've come up with a recurring problem, which I don't really have an optimal solution to, so I'm hoping that someone here might be able to give some best practice pointers.
What I have is a region inside my node.tpl.php, which is populated with blocks that display content from two different CCK fields of the type node_reference. This works fine when displaying a single node. The problem appears when I need to use a view.
For example, lets say I have a news listing, and a single news item view. When I display the single news item I can use the news node node_reference field to reference whatever material I would like to have in my sidebar, but when on the news listing view I would like to reference nodes separately. What would be the best practice to solve this?
I'm having a few ideas, but none seem like the logical choice, how would you do?
My understanding of your problem is that you don't want the blocks to display on the view page and you want the block information displayed inline with the node.
The first part is easy, you can modify the block visibility settings to not show up on the path where you have the view.
The second part will depend on how you set up your view. If you are using fields you can simply add fields for the node_reference and they should display. If you are using a node view, you will have to override the template and create a template which displays the node reference field.
If you want further explanation please comment and I can clarify
After reading my question I realize that it was explained pretty badly, so I'll try again, and also tell how I solved it.
The Problem
On normal "pages" (when displaying only a single node), I have a sidebar that shows something similar to banners, which are either random, or I can select one or many that should always be displayed on the sidebar. This is solved easily when displaying a single node, using a CCK node_reference field. The problem is when using a View that displays multiple nodes, for example a news listing-
The Solution
In my case I could solve this by creating additional fields on my default Page content-type. These fields were called view, display and arguments. In my tpl.php I then embedded the news listing view inside a page, lets call it News. This way I gained great flexibility, and also helps the News page to know where it is located in menu structure.
Final comments
I have yet to discover if there are any drawbacks or dangers in doing this way, but if there are, feel free to share them with me :)
I tend to want to create my own modules, which create blocks and reference the database directly. Then I put the blocks inside of panels, this seems to be more flexible for me than using views and cck fields etc ...

Resources