[wp-hackers] Creating a news site on WordPress - some technical questions
Aahan Krish
krish+wphackers at aahan.me
Sat Dec 14 09:50:30 UTC 2013
Hello,
I'm building a (pretty much) full scale news site with multiple editions,
e.g. US, UK, India, etc. on WordPress, and have a few questions on whether
I am doing things the right way. It'd be great if I can get some
advise/feedback from the experienced folks here.
Coming to the point, below are the details of the structure of the site,
and how I am fixing the hurdles along the way (on which I'd like some
feedback/advise).
- - -
*(1)* Each category (taxonomy) represents an Edition. To give you an idea,
they are as follows:
US (main)
UK (uk)
India (in)
International (intl)
NOTE: Permalink structure is
/%category%/%year%/%monthnum%/%day%/%postname%/, e.g.
example.com/main/2013/12/11/sample-post/.
PROBLEM #1: But as is the case with any news site, some posts need to be
shown across all Editions (for example, news on the death of Nelson
Mandela).
My Solution: I created another category - or Edition, so to speak - called
'International (intl)'. Then using [this function](
https://gist.github.com/anonymous/b216cc899ce94f2fb4f7), I have the posts
assigned to 'International (intl)' category included in all category
archives.
PROBLEM #2: Posts belonging to 'International (intl)' category should be
accessible with any category slug in their permalink.
For example, if the permalink of the post that belongs to 'International
(intl)' category is
`example.com/intl/2013/12/11/sample-post/`<http://example.com/intl/2013/12/11/sample-post/>,
and it's being displayed in the 'US (main)' category archive, I want the
post to be accessible via
`example.com/main/2013/12/11/sample-post/`<http://example.com/main/2013/12/11/sample-post/>
.
To do that, I am using [this function](
https://gist.github.com/anonymous/2c13d98f1330c313550c).
*(2)* Now I have perfect Editions (category archives) for different
countries; and as I've already used the category taxonomy, I created a
custom taxonomy called 'Channels' for organizing posts into topics. To give
you an idea, they are as follows:
Technology (tech) - example.com/channel/tech/
Science (science) - example.com/channel/science/
Business (business) - example.com/channel/business/
But since posts are primarily organized into *Editions*, I need archives
that list posts belonging to an Edition (category) AND Channel (custom
tax). Public query variables make this easy as I'd simply do something like:
example.com/?category_name=main&channel=tech
That'd be an archive for the 'Tech' Channel for the 'US' Edition. And to
prettify the links, I have a function with the necessary rewrite rules: <
https://gist.github.com/anonymous/22160578e145a67bc41a>
I do it similarly for tags as well.
- - -
That's it. Those are the heavy stuff. Am I doing things the right way, or
is that bad?
I didn't opt for WordPress Multisite, i.e. a sub-site for each Edition,
because it'd be hell a lot more difficult to have the same post across
multiple sites (Editions).
I'd very much like to know what you think. Please let me know if anything
is unclear. Thanks for your time!
More information about the wp-hackers
mailing list