Table of Contents Plusを導入
まずは目次のプラグインである「Table of Contents Plus」を導入。 無事プラグインを導入完了!
ページのソースに謎のfront.min.jsが、、
ソースをみてみたら謎のjsが読み込まれていた。
パスに「Table of Contents Plus」と記載されているので、目次プラグインを導入したら現れたので
犯人は「Table of Contents Plus」と確定!
<script type='text/javascript' src='/plugins/table-of-contents-plus/front.min.js?ver=1509'></script>
どうにかしてjsを消すことが出来ないかといろいろ調べてたら、下記のコードをfunction.phpに記述すればいけるらしいので コードを記述。
function onze_toc() {
wp_deregister_script('toc-front');
if (is_single()) {
if (class_exists('doc')) {
wp_register_script( 'toc-front', plugins_url( 'front.min.js', __FILE__ ) , array('jquery'), false, true );
}
}
}
add_action( 'wp_enqueue_scripts', 'onze_toc');
上記は条件分岐で投稿ページにだけfront.min.jsを出力するような記述です。