First, here's an important concept. With Montezuma, when you hear the term sidebar, also think inside, above, and below your content margins. Montezuma not only allows unlimited widgets in your sidebars, you can have sidebars anywhere, such as in your header, footer, and even in the content area of a template.
PHP Code Widget Plugin
The PHP Code Widget Plugin, allows any PHP code be executed in a sidebar.
For this example, we'll use some PHP code that's not on the limited list, and we'll use it in the content area of the main template, like is done here to make the random images at the top of each page.
- In main template, just below the opening div tag for the content area, we insert:
PHP Code:<?php dynamic_sidebar( 'image-gallery-0' ); ?>
- In the widget area, we drag the PHP Code widget to the image-gallery sidebars and insert the PHP code into the PHP Code widget named image-gallery-0.
Code Snippets Plugin
If you're going to repeat code and want to follow Don't Repeat Yourself principles (which make changes much easier later), there's another great PHP plugin called Code Snippets Plugin. It allows you to add callable PHP code to your site, without modifying any of your wp or theme files.
I put all the code to make the random images into a snippet, then, in the PHP sidebar, just called the function. This way, if I change something, I only have to edit the snippet, and it will get changed everywhere it's used.
It's a good idea to prefix all your custom function and global variable names with something like:
PHP Code:
custom_
If you're putting variables into your snippets, and calling them later, you may also have to use the global construct to access them.
Happy coding!
Update: Here's an example from Juggledad using a different php plugin "exec php".