We recently purchased the X theme in order to update a client’s website, because for whatever reason WordPress says it’s up-to-date, when in fact the installed theme is using functions that were deprecated in PHP 7.2, but I digress.
Anyway, we downloaded the X theme from ThemeForest and uploading it according to the documentation at https://theme.co/docs/installation-and-validation (which ultimately places the X theme in a directory named “x” in the WordPress themes folder), however, upon reloading the page after installation, WordPress immediately encounters a critical error.
Looking through the debug logs, I noticed this one error that said…
PHP Fatal error: Uncaught Error: Class "Cornerstone_Shortcode_Preserver" not found in .../wp-content/themes/x/framework/legacy/functions/plugins/cornerstone.php:255
So I decided to search the theme’s files to try and find that class, which I attempted with a string search recursively through each of the files…
$ grep -rno "Cornerstone_Shortcode_Preserver" ./*
./framework/legacy/functions/plugins/cornerstone.php:255:Cornerstone_Shortcode_Preserver
So, it would seem that the only instance of the string “Cornerstone_Shortcode_Preserver” is in the file triggering the fatal error, and the line of code triggering the error is this…
Cornerstone_Shortcode_Preserver::preserve( 'code' );
I searched these forums for posts regarding the same problem, but there weren’t any regarding that specific error (that had been resolved) that I could find. I did, however, come across this one post which made a reference to the path of the Cornerstone_Shortcode Perserver class, which was wp-content/themes/pro/cornerstone/includes/classes/classic/utility/class-shortcode-preserver.php. I noticed that the path mentioned was for that class in the Pro theme, but I checked to see if it was in the same spot in the X theme…and it is here where things got a little confusing.
The path to the Cornerstone_Shortcode_Preserver class did not exist on the X theme, as referred to by the aforementioned post, however, I did notice that there was a cornerstone.zip in the framework directory, and when I viewed the contents of that zip file, sure enough, that entire path was there. I don’t remember seeing any reference to unzipping that file, but I guess it it possible that the theme was supposed to do that and for whatever reason couldn’t. So I unzipped the cornerstone.zip file, which resulted in the class-shortcode-preserver.php file ultimately being located at wp-content/themes/x/cornerstone/includes/classes/classic/utility/class-shortcode-preserver.php.
However, when I reloaded the page, that same Fatal PHP error was being triggered (Uncaught Error: Class “Cornerstone_Shortcode_Preserver” not found…).
So…what gives? Why am I not able to install the X theme, strictly according to the documentation provided by the developer of said theme? On that note, why isn’t there a way to update the theme from within WordPress?
But beyond that, how can I get the website to a usable state with the X theme enabled, and preferably in a timely manner? We’re already stretching the budget just trying to get the theme updated, and we have actual development to do still.
BTW The website already had and outdated copy of the X theme, so I enabled a core theme (something like twentytwentytwo), and then deleted the old theme just to make sure there weren’t any conflicts with the old theme…in case anyone is wondering.