我需要在我的特定帖子(帖子 9597)上添加一些链接信息和一个简短的脚本。我将以下代码添加到我的主题 functions.php
function chromeextension_head() {
if(is_single( '9597' ))
?>
<link rel="chrome-webstore-item" href="https://chrome.google.com/webstore/detail/pknhdfeakbecfgahlbdfnjfjgbkgllfo">
<script>
function ExtInstall() {
if (chrome.app.isInstalled)
alert("already installed!");
else
chrome.webstore.install();
}
</script>
<?php
}
add_action( 'wp_head', 'chromeextension_head' );
问题是现在代码显示在所有帖子和页面上,而不仅仅是帖子 9597。我做错了什么?