Sometimes the need arises for an array of Page objects ordered hierarchically, but all there is available is just a collection of Page objects ordered by title for example, maybe because they were previously fetched from the database through the global
$wpdb object. On these occasions, to hierarchically reorder an array as such, we have to be creative, because WordPress isn't equipped with an utility function made up on purpose — or at least I have not dug enough to uncover one. In truth, I simply enjoyed looking for my own solution, and that's the main reason why I am here now writing about it.
It would be much more worth writing about a restorative experience lived in a difficult 2020, but I am just a young life-learner who mingles drops of code into a cauldron full of hope, and as such I can only wish you to find in this update that bit of extra usefulness that SiteTree was still missing.
After an outburst of emotions that only Fred Flintstone could have expressed better, an unstoppable need to thank every single person who contributed to reaching this milestone made a heartfelt "Grazie!" to spring out of me. Just the time to catch it, that I was already sticking it between these lines: in no case it could have failed getting to you.
The last of a year-long succession of updates is here, ready to salute this prolific 2020 that has seen SiteTree growing from an idea of the past to a sitemap builder plugin much more able, way more robust in structure, and with a regained character. In this release the shortcode feature introduced with SiteTree 4.5 is further enhanced by the introduction of a new attribute — SiteTree keeps collecting Flexibility.
Out of curiosity, about a month ago, I fed the terminal a one-liner program that would have tallied the number of lines of code I had put together to give life to SiteTree Pro. The terminal displayed a number slightly over 13k. Looking at it with a bit of proud, I realised a crossroads was just showing up before me: one path went on with SiteTree Pro in constant growth, the other turned a little to lead straight towards an adventure even more nestled into the WordPress jungle. I really liked what I had built up until then, but the ideas that were bubbling in my head inspired me even more. So I immediately got to work, and after 3k new lines of code, I can finally announce the release of the first Leaves for SiteTree!
To carry out such a task, there is no utility function made up on purpose in WordPress. After all, deleting all the data associated to a taxonomy isn't a common task, or at least not something you routinely do. Me, for example, I ran into the problem while writing the
uninstall.php script for SiteTree Pro 4.0 — a file loaded when not all the WordPress functions are available, either. But even considering a more generic context, the most streamlined solution that can be adopted is to use three custom queries.
While working on the personal area opened recently, the need arose to add a left arrow to a go‑back link without making any changes to the markup, mainly because I had no control over it. The solution followed naturally: use the
::after pseudo-elements to draw respectively the point and the shaft of the arrow.
Developed on macOS, the bash script you are going to read about is born from the need to automate some of the tasks a plugin developer has to routinely do to publish plugin updates on WordPress.org.
In the WordPress jargon a Drop-in Plugin is a PHP script that replaces a functionality of WordPress, somehow becoming part of the core. In fact these special plugins don't need to be activated to be loaded, they just have to be dropped in the