You can use this function to get the current theme:
https://docs.zenphoto.org/1.5.x/function-getCurrentTheme.html
I personally would not do things like this via codeblocks but rather modify a theme (in fact I never use codeblocks myself). Codeblocks are a workaround and you easily forget what you did in a codeblock or did something at all especially if you have a lot of pages etc.