Support community for TTG plugins and products.
NOTICE
The Turning Gate's Community has moved to a new home, at https://discourse.theturninggate.net.
This forum is now closed, and exists here as a read-only archive.
You are not logged in.
Pages: 1
Can BL's custom backlight.php be used for customizing WordPress pages when using a BL generated theme? Specifically, I'd like to use the ttg_head hook to insert something into a particular WP page's <head>. TIA!
Last edited by rsamco (2017-12-06 04:01:30)
Rick
Offline
I was playing with ttg_head the other day and it can, in fact, insert things in the <head> of a wordpress page but you need to use conditional logic to make sure the page you're on is in fact a wordpress one.
Charlie
www.stalkinglight.com
Offline
Charlie, how did you test for a particular WP page? is_page() is apparently not available. I suppose one could parse and test the hook's $path parameter. But I suspect that there is an easier way, but haven't found it yet.
Rick
Offline
What I do is look at the URL ( $_SERVER[REQUEST_URI] ) as you mentioned. There may be a better way but I don't know it either.
Charlie
www.stalkinglight.com
Offline
What I do is look at the URL ( $_SERVER[REQUEST_URI] ) as you mentioned. There may be a better way but I don't know it either.
I have a function that is based on the same technique:
function page_match($gallery) {
if (substr($_SERVER["REQUEST_URI"], 0, strlen($gallery)) == $gallery) {
return 1;
} else {
return 0;
}
}
This function returns 1 for subpage matches too, eg, page_match('/blog'). This works well for my purpose.
Daniel Leu | Photography
DanielLeu.com
My digital playground (eg, Backlight tips&tricks): lab.DanielLeu.com
Offline
Nice, I thought about doing something similar with switch / case to return different values for my various pages but never got around to it.
Charlie
www.stalkinglight.com
Offline
Here's what I ended up with:
function ttg_head( $style, $path ) {
// refresh WordPress page <wp_page> every 5 minutes
if (substr($_SERVER["REQUEST_URI"], -strlen('/<wp_page>/')) == '/<wp_page>/') {
echo '<meta http-equiv="refresh" content="300">' ;
}
return false;
}
Last edited by rsamco (2017-12-06 09:28:39)
Rick
Offline
Pages: 1