Instead of using $post = get_post($post_id);
, you can call global $post;
which will load the value of the current post assuming that you have not triggered any other loops.
Instead of using $post = get_post($post_id);
, you can call global $post;
which will load the value of the current post assuming that you have not triggered any other loops.