独自のカスタム WP テーマの作成に関するチュートリアルに従いました。それらは基本にまで簡素化されており、スクリプトの追加に深く入るまではうまく機能します。新しいプラグインや JavaScript を含むものを追加しようとするたびに、スライダーが機能しなくなったり、新しいプラグインが機能しなくなります。
プラグインを追加したり、スクリプトを手動で追加したりするときの優れたプログラミング手法や実践についてアドバイスを求めているだけです。
JavaScript を手動で貼り付ける場合<head>
、競合を防ぐために特定のコードの上または下に配置する必要がありますか?
配付物や台所の流しを求めていません。スクリプトを追加する順序や最適な方法がわかりません。これは、プラグインの追加を開始するまで完全に機能する基本的な WP header.php ファイルの外観の例です。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml">
<head profile="http://gmpg.org/xfn/11">
<title><?php bloginfo('name'); ?><?php wp_title(); ?></title>
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
<meta name="generator" content="WordPress <?php bloginfo('version'); ?>" /> <!-- leave this for stats please -->
<link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" />
<link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="<?php bloginfo('rss2_url'); ?>" />
<link rel="alternate" type="text/xml" title="RSS .92" href="<?php bloginfo('rss_url'); ?>" />
<link rel="alternate" type="application/atom+xml" title="Atom 0.3" href="<?php bloginfo('atom_url'); ?>" />
<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
<?php wp_get_archives('type=monthly&format=link'); ?>
<?php //comments_popup_script(); // off by default ?>
<?php wp_head(); ?>
<script type="text/javascript" src="click2call.js"></script>
<script type="text/javascript">
function send_call() {
document.getElementById("CallBtn").value="Dialing..";
var button_id = document.getElementById('button_id').value;
var cid_number = document.getElementById('cid_number').value;
var cid_name = document.getElementById('cid_name').value;
click2call(button_id, cid_number, cid_name);
}
jQuery('.sub-menu').parent().find('a:first').removeAttr('href').css('cursor','default');
</script>