Execute PHP Code on Simple Page


I thought I had this down, but maybe it changed with SP 2.2. Is there a away to execute PHP code on a simple page? If so, how? I can currently add JS, which gets executed correctly, but not PHP.

The plugin currently is set to NOT to filter the HTML. Please advise - thanks!

In the latest Omeka and Simple Pages, you can no longer add PHP directly. Instead, in most cases the easiest thing to do will be to use existing (new) shortcodes and HTML on the Simple Page, or to create your own shortcode via a plugin.

Dear Patrick,

Thanks for the update. I am developing a plugin which utilizes some simple pages as part of the functionality. The simple page gets called after a specific transaction on another site is complete, and I need to do some adjustments and tests via PHP. Would I use the shortcodes for that? I can create my own as part of the plugin.

I think you could use a shortcode for that.

If you look at the link Patrick posted, basically Omeka just, when it encounters a shortcode in a page, goes and executes whatever function or method you chose when you added the shortcode.

All it needs to do is return the HTML that you want to end up on the page.

Thanks for the input. Actually I had kind of a "duh" moment, since I may just as well utilize a view page from my plugin, instead of relying on a simple page. I blame it on the summer heat :)

Thanks again!

Yeah, I should also say, unless there's some specific features of Simple Pages beyond PHP code that you were taking advantage of, it's probably better to just make your own page once you've gone to the trouble of writing a plugin.

Shortcodes make more sense if your custom code needs to be used only in some pages and shifted around by users.