-
Notifications
You must be signed in to change notification settings - Fork 3
News
As of this writing, a new MIT Libraries News theme is under development. The repo for this theme is here.
While this theme exists as a child theme of the main libraries.mit.edu WordPress theme, many of the relevant styles and scripts for /news (as well as relevant Grunt tasks) are actually being built inside the parent theme. The news branch contains this development work. This is primarily to ensure that a comprensive, congruous design/theming system is maintained across the libraries.mit.edu WordPress instance.
The two news items on the front page the site (http://libraries.mit.edu) are built directly by WordPress, rather than a previous system that loaded them via the WP API. The logic that controls this process is found in page-home-direct.php. There are three basic steps:
- Determine the state of the candidate pool
- Build and run quer(ies)
- Render items
This step attempts to determine whether two situations are true:
- Are there only two eligible items? If so, follow option
2Abelow. - Is there only one "news" item? If so, follow option
2Bbelow.
If neither of the above condition exists, then randomly choose either 2B or 2C
The queries to pull news items fall into one of three catgories:
2A - Display two items
This is used when there are only two eligible stories, so the query is very simple - just grab two items.
2B - Display one news and one feature
This is used in cases where only one eligible news item exists, or when the coin flip in step one selects only one visible news story.
2C - Display two news items
This is used only when there are two such eligible news items, and the coin flip elects to actually show two news items.
This step takes the built object of two items, and renders it as HTML.