All Questions
Tagged with wp-localize-script wp-query
2 questions
0
votes
0
answers
483
views
Pass post ID to JavaScript outside the loop
I try to pass the post/pages ID to my JavaScript file. url and template_url works but the id just return 0 on every post.
PHP:
// Register scripts
wp_enqueue_script('scripts', ...
0
votes
1
answer
483
views
localizing variable on front-page.php template fails but succeeds on single page and taxonomy archive
I have the following code in a php include file:
function pass_the_var() {
$video_embed_code = jkaw_oembed_code();
return array(
'embedCode' => $video_embed_code
);
}
...