How to hook into checkPageValidity

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?

Comments

  • acrylian Administrator
    edited December 2018

    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.

Sign In or Register to comment.