ZenphotoCMS Forum
How to hook into checkPageValidity - Printable Version

+- ZenphotoCMS Forum (https://forum.zenphoto.org)
+-- Forum: Support (https://forum.zenphoto.org/forum-1.html)
+--- Forum: General support (https://forum.zenphoto.org/forum-4.html)
+--- Thread: How to hook into checkPageValidity (/thread-13194.html)



How to hook into checkPageValidity - wongm - 2018-12-27

The 'checkPageValidity' method provides a custom way to flag URL pages as out-of-bounds for custom themes.

But I can't seem to make it work in my custom theme:
https://github.com/wongm/rail-history-cms/blob/master/themes/rail-history-cms/functions.php

Custom code is:

```
function railHistoryCMS_checkPageValidity($request, $gallery_page, $page) {
// CUSTOM STUFF
return checkPageValidity($request, $gallery_page, $page);
}
global $_zp_page_check;
$_zp_page_check = 'railHistoryCMS_checkPageValidity'; // opt-in, standard behavior
```

Calls to `checkPageValidity` are never executed, with `echo "X"` outputting nothing, and modifying the generic `checkPageValidity` in the same way also shows nothing.

Any other places I should start digging around?


How to hook into checkPageValidity - acrylian - 2018-12-27

Take a look at the Zenpage theme's `functions.php`.

As you did you define a function or (static method since you use a class already which is preferred to function name prefixing) to hook into.

Then add this calling your function or (static) method:
`if (!OFFSET_PATH) {
$_zp_page_check = 'my_checkPageValidity';
}`
also to your theme's `functions.php` so it is only covered on .
You don't need to set `$_zp_page_check` to global as it is already especially outside of functions/methods.

I am not sure what pages those are listsed in your function and how you use pagination. What is `lineguide.php` for a page for example? Static custom pages generally "don't know" pagination.