I am working on a site where I want multiple sub-content to show under as a part of the main content.
The best example would be [[LINK href="http://www.ign.com/cheats/games/grand-theft-auto-episodes-from-liberty-city-ps3-59690"]]this page[[/LINK]].
So for what I am trying to achieve, the game's name up on top & the details and thumbnail at the right would be the main content.
The subsections would be the categorized content (All | Cheats | Unlockables | Hints | Easter Eggs | Achievements) that is showing up under the title.
I'm wondering what the most efficient way to do this in Wordpress would be. I am not having much luck trying to come-up with a working solution so I need some help.
<strong>Please note: This question is only to get an idea on whether or not it is possible to accomplish this with-in wp. I will definitely award a higher prize for a working solution.</strong>
John Cotton answers:
This sounds similar to something I did with this site:
If you view that page, you'll see a series of tabs at the top. As you click each, the content changes (as does the URL, but don't read anything into that, it's all custom rewrites).
Each of the tabs effectively represents a custom post type (and you're seeing a pseudo archive of that post-type).
What holds it all together is single custom taxonomy of country. So each post-type (as well as posts (news) and links) has countries associated with it and that taxonomy is used to filter the various requests).
So the structure is similar to that proposed by Louis, although rather than being hierarchical (which I think would be restricting - or, at least, harder to change) it's flat with a taxonomy used to provide the "joins".
No plugins :), just a little bit of code.
John, that definitely looks similar to what I want to do.
Not too keen on having the urls change though. As all that I need at the moment is a main page showing subsections all under 1 url (as in the example). Seeing what you submitted I'm sure that is definitely possible.
The data to populate is all in a CSV (i can reformat the structure depending on what will work), so as long as there is a way (i don't see a reason why there wont be) to populate it from that CSV using the non-hierarchical structure that definitely sounds more flexible.
I need this working as soon as possible. Since you have already done something very similar... you up for the challenge?
John Cotton comments:
Send me the CSV file and let me have a look.... john AT dynamic array - co - uk - no spaces
Just sent you an e-mail.
Luis Abarca answers:
I think that custom post types, with hierarchical structure can do the trick.
So, hints, Cheats, etc, will have as its parent the main post content.
<strong>Grand theft auto (post or game CPT)</strong>
|- Hints (hints post type: WP_Query('post_type=hitns&post_parent=$post->ID') )
| |-- <strong>Easy Health and Armor Boost in The Ballad of Gay Tony </strong>(post title)
| - Once you have unlocked base jump challenges in TBoGT you .... (post content)
| - Posted By (post author)
|- Cheats (cheats post type: WP_Query('post_type=cheats&post_parent=$post->ID') )
| |-- <strong>The Ballad of Gay Tony Weapon Pack</strong>(post title)
| - Call 486-555-0100 for the following weapons: .... (post content)
| - Posted By: AngryMexicanGuy (post author)
Hey, that's what I was thinking as well Luis!
Just have no idea how to make it work. Could you elaborate a little on how this would work?
So Hints, Cheats, etc. are all custom post types but how would they show up under the main content?
Luis Abarca comments:
yep, i updated my answer with an example, to get the hint list, you should call all the hints post type with a particular post parent.
So you can also have an archive-hints.php with all the hints of all games.
So when its all done & laid out it looks like the page i gave as an example in the original post?
archive-hints.php is not important at all. Its the main page (the one in the example) that I am most interested in.
I have all data saved in a CSV and I import it through the CSV Importer plug-in how would I need to lay it out?
I'd like to go ahead and get this done. Please suggest a more appropriate prize.
Luis Abarca comments:
I never used the CSV import plugin before, but if works as the XML/Wordpress import, maybe can take a post type and a post parent column.
Alright, so how do I get this thing going?
Julio Potier answers:
Parent Custom Post Types with Child Custom Post Type is a good way to acomplish this.
Here's a link to generate CPT : http://themergency.com/generators/wordpress-custom-post-types/
Hey I have used that link already. Thanks.
I am more stuck at getting everything to fit together somehow.
Lawrence Krubner answers:
Note: I am Lawrence Krubner, the owner of WP Questions.
As a procedural matter, when an asker posts a prize of $1, and it is clear that they will raise the prize if they get a working solution, I think the experts should suggest what they think the prize should be.
Thanks Lawrence, since I don't know how much work would be involved. I didn't want to put an unfair amount which undervalues the time of anyone working on this.
I couldn't find an "open to fair suggestions" option when putting this up.
The experts should definitely suggest an appropriate amount. I was under the impression that the $1 prize would signify that anyways.