Books Magazine

Changes Made to How Interpretive Information is Retrieved

Posted on the 12 April 2018 by Hmcurator

Anyone who thinks they can set up a WordPress website and forget about it is fooling themselves. Case in point: when I first started designing the Harvey Mercheum website, I knew that I wanted to store what I now refer to as the “interpretive information” about the exhibits as fields in the WordPress MySQL database, not just as plain text. I accomplished this using custom fields and custom taxonomies.

Once I started designing the exhibit pages, and set up the HTML table to display the interpretive information, I faced a challenge. As a database programmer by trade, I knew that double entry of data was to be avoided at all costs, and yet there was no easy way to reference my custom fields in the table. The solution I came up with was to write a series of shortcodes to extract the values of the custom fields and display them. I had to write different code for fields and taxonomies, but I got it working, and it has worked since the day the Harvey Mercheum website went live.

As I was new to WordPress, I used a plugin called “Shortcode Exec PHP” to create these shortcodes. SiteGround recently updated the “PHP Config” portion of their SG Optimizer plugin to check for PHP 7.1 compatibility. I decided to run it, and it reported problems with Shortcode Exec PHP. I went to the support forum for the plugin to report the problem, and discovered that the plugin was no longer supported!

I did some research as to how shortcodes are supposed to be created, and read several articles such as this one:

How to Create Your Own Custom WordPress Shortcode

I then used Code Snippets to create a snippet with all of my shortcode creation code. I had to modify it slightly to get it to work. I then deactivated Shortcode Exec PHP, and confirmed it was disabled by viewing an exhibit page and seeing the shortcodes instead of the data they extract. I then activated the snippet and checked the exhibit page again and now I see my interpretive information again.

If you notice anything unusual about the interpretive information on exhibits, or would like more information on anything I discussed, please leave a comment below, or use the Contact the Curator form!

Back to Featured Articles on Logo Paperblog