0

投稿の一部としてさまざまな WP インストールに含まれる HTML/JS スニペットを作成する必要があります。いくつかの jQuery 関数が必要なので、jQuery が既に含まれているかどうか、およびそれをロードしないかどうかを確認する必要があります。場合によっては、jQuery がフッターに含まれていて、私のスニペットがそれを検出しないことがあります。誰かがこれに目を通すか、含めるためのユニバーサル HTML/JS スニペットを作成するときに心に留めておくべきヒントを教えてください。

<script>
 if (typeof jQuery === 'undefined') {
    document.write(unescape("%3Cscript src='http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js' type='text/javascript'%3E%3C/script%3E"));
}

 jQuery(document).ready(function(){
 jQuery("head").append("<link>");
   var css = $("head").children(":last");
   css.attr({
     rel:  "stylesheet",
 type: "text/css",
     href: "http://www.domain.de/assets/style.css"
  });
 });
 </script>

 <div id="buy" style="width100%; float:left;">
 <a href="#">Jetzt kaufen</a>
 </div>
 <div style="display:none;width:100%; float:left;" id="logos">
<ul>

 <!--Ab hier editieren -->
    <li><a href="#" target="_blank"><img src=""></a></li>
    <li><a href="#" target="_blank"><img src=""></a></li>
    <li><a href="#" target="_blank"><img src=""></a></li>
    <li><a href="#"><img src=""></a></li>
    <li><a href="#"><img src=""></a></li>
 <!--Ab hier nicht mehr editieren-->
<ul>
 </div>
 <script>
 jQuery('#buy a').click( function() {
 jQuery('#logos').slideDown();
 } )
 </script>
4

1 に答える 1