I’m developing a site for an African language translation company and am currently trying to think of the best way to structure the site
I have a custom post type of “Languages” set up, with posts like Arabic, Somali, Swahili etc but each of these posts need “sub” posts within them i.e History, Where is it spoken, Dialects, Alphabet & Writing system
What would be the best way of setting this up? There are going to be around 140 languages so I don’t think setting up individual posts for the 3/4 sub pages for each language is a good way to go as we’d be looking at over 500+ posts
I’m wondering if I can set up “base” posts for the 3/4 sub pages seeing as the titles will always be unique, just the content will be different
I’ve waited for quite a while for an answer to this and have had to continue on with the project so thought I would answer myself
First off I set up the custom post type of language, then hooked in to the
publish_language
action to programatically add child posts like so:Next, I had to add in logic to delete/trash child posts when their parent was deleted/trashed by hooking in to
before_delete_post
andtrash_language
Ok so we now have child posts being published and deleted in sync with their parent language. Next I had to ensure only top level languages were being pulled through in the admin ui language list so I hooked in to the
request
action:Lastly, I had to inject some custom CSS and JavaScript by hooking in to
admin_footer
which added an expand/contract link to each language, with an ajax call to a function which gets child posts of the selected language and displays them in the standard wordpress table format:With this in place, all I had left to do was the add in the ajax callback function to get the child posts based on the selected language:
I hope this helps out a future googler with a similar issue or anyone else browsing this website