有人能請你告訴我在哪裏插入我下面的javascript代碼:添加JavaScript到PHP代碼
<?php
global $post,
$mk_options;
$page_layout = get_post_meta($post->ID, '_layout', true);
$padding = get_post_meta($post->ID, '_padding', true);
if (empty($page_layout)) {
$page_layout = 'full';
}
$padding = ($padding == 'true') ? 'no-padding' : '';
get_header(); ?>
<div id="theme-page" <?php echo get_schema_markup('main');
?>>
發生了什麼事時,「get_post_meta」引起我的博客文章日期在我的谷歌搜索結果頁面顯示。我做了一些研究,知道我需要添加下面的代碼,我只是不確定在上面的代碼中插入它的位置。
<script language="javascript" type="text/javascript">document.write
(I believe my code goes here) </script>
我真的很感謝一些幫助。這是我第一次在這裏發帖,所以如果我沒有正確發佈問題,請告訴我!
@ Script47也許。看看[wp_enqueue_script](https://codex.wordpress.org/Function_Reference/wp_enqueue_script),這將有望滿足您的需求。 – Jan