Hi all,
I understand that all global variables have to be within a function now.
However, I’m struggling to think of a way to retrieve the ID of the “Page Template” that contains posts and each post makes a call to check an option of the “Page Template”.
Usually I would do the following e.g. blog.php ( Blog Template )
global $myvar; $myvar = ( get_post_meta( $post->ID, '_'. THEME_PREFIX .'_someoption', true ) !='' ) ? get_post_meta( $post->ID, '_'. THEME_PREFIX .'__someoption', true ) : '';
Within the post I’d then use that variable.
Since it now has to be within within a function e.g.
function myvar() { global $wp_query; $post = $wp_query->post; $myvar = ( get_post_meta( $post->ID, '_'. THEME_PREFIX .'_someoption', true ) !='' ) ? get_post_meta( $post->ID, '_'. THEME_PREFIX .'__someoption', true ) : ''; return $myvar; }
The issue is, that now tries to use the ID of the post that called it, not the ID of the “Page Template”.
I’m desperate for some help with this, thank you. It’s probably something simple, but my Friday brain is missing it if it is.