Integrating an Accordion Menu into WordPress with a cformsII plugin
Tuesday, December 22nd, 2009These challenges arose while I was building a site for Caliber Hospitality. This article is more of a series of notes about how certain challenges were overcome and is geared toward other web designers working with WordPress.
WordPress and the JavaScript Accordion Menu
Integrating WordPress with the JavaScript Accordion Menu was first a matter of finding the correct menu coding that would not break WordPress. My first try failed, but then after some perseverance, I came across this JavaScript Accordion Menu (http://www.leigeber.com/2008/05/horizontal-javascript-accordion-menu/) and it worked.
When creating WordPress sites and/or custom templates, I like to begin with the WordPress Default Template and then strip it down and customize it from there. Because there were to be several of these accordion menu’s in the site, that meant creating a separate template for each page with an accordion as they were all to be different. The accordion menu images were all placed via CSS as background images.
WordPress + Accordion Menu + cFormsII Plugin
Another roadblock came with the contact forms living inside the sliders. The contact forms (http://www.deliciousdays.com/cforms-plugin/) were detecting their size on load which was not relevant to their actual size once the page was loaded. When the page did load the contact forms where an illegibly squished pile of text. I had hoped just adding a fixed width to a div tag would solve the problem, but it wasn’t going to be that easy. I overcame this by placing an iframe in the page and that seemed to do the trick. I created separate pages in WordPress for the iframe content, and then used an exclude to keep those pages from displaying in the navigation.
I was no longer able to use WordPress’ Visual Page Editor with the iframe coding as it would strip the iframe code when switched to Visual mode. This was a drag for the client, but I didn’t see another way around it. I think hard-coding the iframe tags into the page template would be a good solution to keep the Visual Editor as an option. Of course, the contact form would have to be in one of the first or last sliders to make this work.




First you’ll browse for your image. You’ll then need to decide whether or not you need the image resized and/or a thumbnail created. Resizing your images is the norm for web use, so if you haven’t done so already, you’ll want to keep that box checked. The default 640 px is a good starting point. I normally do mine for 700 px. Keep in mind that most screens are between 1000 px and 1400 px wide. If the pic is going to be on the bigger side, it may be best to display a thumbnail that can be clicked on for a larger image. The next step is to insert the image into the post. You’ll want to decide if you want to display the image at full size, or the thumbnail if you created one. You also want to decide if you want the image aligned left or right or center. Keep in mind if you align the image, the text will wrap around it. Normally that’s a good thing. Often people have a tendency to center images or headings, but this is a design no no unless the whole page is already centered. You want to keep your alignments consistent for text. In most cases it will be all left or centered. That said, aligning an image to the right will not throw off how the page looks if the text is all left aligned. You just don’t want to mix centered content with left aligned content. The next step will be to push the insert into post button. Then you’re all set. The code has been created for you. If you click on the HTML tab, it will look something like this:




