Flipping Between Key Links and Standard Hyperlinks

The Communicating With Prisoners ortext comes with its key links already flipped into standard hyperlinks. TheĀ Ortext Build plugin includes in the file otx-util.php functions to transform key links into standard hyperlinks and to transform those standard hyperlinks (associated with key links) back to their key links. If you want to experiment with key links, these functions will be useful. When appropriately set up, they can be run from the “Run utility” button on the ortext settings page.

When you’re writing an ortext, some key links may get broken. You can test the validity of the key links without making any database changes by setting the database-write variable to FALSE in the flipping function. Uncommenting some of the error-logging lines will help you identify problems with particular key links. Good practice is to check that the links are correct before you enable writing to the database.

The flipping functions are named keylinks_to_permalinks and permalinks_to_keylinks within the class Otx_Util. You don’t need to be a WordPress and PHP expert to experiment with these functions, but you should look them over before running them. Hiring a WordPress expert, who deserves to be well-paid, can easily be more cost-effective than destroying a lot of your work and enduring weeks of frustration.

The flipping functions can handle normal post content as well as content stored in JSON format (TablePress tables). You specify the post_type to be flipped with the initial $target_type variable. Note that if you specify as the post_type any, that will not include the non-public post_type tablepress_table. The later is the post_type relevant for flipping links in TablePress tables. We suggest flipping one post_type at a time and verifying the results. The relevant post_types to flip for this ortext are post, notes, refs, statistics, datasets, tablepress_table, and page. Note that the ortext-specific custom post_types are in the plural, while the others aren’t.

Flipping from keylinks to permalinks (which is more computationally intensive) can take about 5 minutes of run time for the notes and post post_types in this ortext on a mediocre computer. If you want to experiment with flipping links back and forth between keylinks and permalinks, we suggest that you install the Ortext Build plugin on a separate, new, local WordPress installation. You can then create a few posts and experiment with linking and flipping between link forms.

Leave a comment (will be included in public domain license)

Your email address will not be published.