wp-content

wordpress/hph
Log | Files | Refs | README | LICENSE

commit b0243d7dcbe8537d34a619ab2b8dea13a8fb81be
parent 6f713c602b5cb00c545d6af1fc2c5ddeb5715a42
Author: Sean Enck <sean@ttypty.com>
Date:   Sat, 24 Jan 2026 12:24:34 -0500

Migrate wiki content to readme

Diffstat:
MREADME.md | 3+--
Aplugins/hphp/README.md | 55+++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 56 insertions(+), 2 deletions(-)

diff --git a/README.md b/README.md @@ -22,5 +22,4 @@ HTML and/or get some basic sum of counter values as well. This is currently deployed for [Happy Paws Haven](https://happypawshaven.pet) -See [usage](https://github.com/enckse/wp-content/wiki/Usage) for more -information +See [usage](/plugins/hphp/README.md) for more diff --git a/plugins/hphp/README.md b/plugins/hphp/README.md @@ -0,0 +1,55 @@ +## hphp + +The "Happy Paws Haven Plugin" is used to provide dynamic value updates without haphazardly updating pages where WordPress, the theme, and other plugins can make it difficult to do basic development. Additionally plugins and/or workarounds to provide these features make the pages themselves polluted with components that really do not belong inlined in a page (e.g. javascript). + +### settings + +Once the plugin is installed (via zip), navigate to the administrative Settings area and go to "HPHP", this is where the settings are for the plugin. + +#### variables + +When the plugin is first installed the only things to edit are in the "Advanced Configuration" area (click the button to expand). What needs to happen first is to setup the data information you want to have variables for. For Happy Paws Haven itself, that is something like this JSON: + +``` +{ + "counters": { + "dogs_adopted": "int", + "cats_adopted": "int", + "pocket_pets_adopted": "int", + "trap_neuter_return": "int", + "sanctuary_animals": "int", + "total_animals_adopted_matcher": "sum" + }, + "scripts": { + "plugin": "js" + } +} +``` + +Which creates 5 integer counters and a single sum (add up counters) variable. Save the settings and when the page reloads it will populate with the new variables. + +From here: +- "int" counters are simple (unsigned) integer counters +- "sum" counters do a (primitive) string contains match and any other variable containing the text for the "sum" variable will be tallied up + +Additionally it will deploy the core plugin javascript + +#### pages allowed + +The value to control which pages are allowed to process the data (to minimize extra processing) is a comma-delimited list of (again primitive) string contains matching against page names. (additionally, regardless of the situation, the payload generated will include the page name if it can be determined). + +For example if there is a "home" and "summary" page that should have the counters enabled (but no other pages), one would put "home,summary" into the field. + +#### onready + +If using document ready (via jQuery) is preferred (not the default) check the corresponding box. This will initialize counter data using the normal document ready function. + +### pages + +The value of a counter will be placed in the name from the settings JSON with a prefix of `hphp_counter_` and suffix of `_display` (e.g. to set a div value from `dogs_adopted` one would place `<div id="hphp_counter_dogs_adopted_display"></div>`). + +Some helper utility scripts are available in the [utils area](/enckse/wp-content/tree/master/plugins/hphp/utils) to provide starters for embedding the necessary HTML/CSS to enable the plugin to update components. + +#### manually + +If the "onready" checkbox is NOT set, then a `<script>` tag needs to be added in the page and it needs to call one of `hphpInit()` or `hphpInitAndHide("id-to-hide")` where `hphpInitAndHide` will call the init function and then hide the given div (likely the segment holding the `<script>` component if this is used).