I’ve been hacking away at a Wordpress implementation for my church, Immanuel Lutheran. To be more accurate I have been customizing a WordPress theme for their Wordpress site. I am incorporating a DHTML menu solution from Deluxe Menu as well as implementing my own Side Bar asides for individual pages. The hurtle of late has been how to default to showing what top level tab was active in the menu when a user was 2 or more levels deep. Second to that was knowing what aside text to show at that level when no aside was given to that page.
Using simple recursion to traverse up the tree of the page hierarchy I was able to accurately land the top page or parent from any location in the site. I say “simple” as it was “simple” to write after I spent three hours researching the Wordpress object model and function library, not to mention the contortionist like bending I had to do with my brain to efficiently and safely write the recursive loop.
So now that I could go up and down the tree with ease my second big issue was being able to pull page objects by name and not ID. Add a dash of Google and a smidgen of forum browsing and walla! you find the “Get-a-post” plugin. Just a simple PHP function include plugin that builds out a post object by querying the WP database by slug name instead of ID. Awfully clever… but hats off to the WP engineers for such a dynamically rich API that allows for such customization. With this plugin and a minor modification or two I am now able to fetch aside text for any page in the site or default to the aside text of the top most parent page.
Now to add blinking text…
Leave a Reply