The $post
object is not available outside the Loop, unless you globalize it before referencing it:
global $post;
$variable = $post->post_title;
The $post
object is not available outside the Loop, unless you globalize it before referencing it:
global $post;
$variable = $post->post_title;