WordPress とライブリンクを操作しようとすると、問題が発生します。
説明させてください:
というカテゴリにこのリンクがあります:
<a href="p?32" id="control">event 32</a>
イベント 32 は、次のコードで管理されます。
$.ajaxSetup({cache:false});
$('#control').click(function(){
var post_id = $(this).attr('href')
$('#calendar').animate({top:'-99em'},400,
function(){
$(this).hide();
$('#theEvent').fadeIn(400);
$('#theEvent').html('<div class="loading"></div>');
$('#theEvent').load(post_id);
});
return false;
});
これは完全に機能します。このシングルの内容は次のとおりです。
これはsingle.phpです:
<div class="space"></div>
<div class="clearfix">
<?php the_post(); ?>
<div class="descritpion">
<h2><?php the_title(); ?></h2>
<span><?php the_author(); ?></span>
<?php the_content(); ?>
<div class="center">
<a href=# id="prev">Prev</a>
<a href=# id="next">Next</a>
</div>
</div>
<div class="gallery" >
<a href="/#fourth" id="close" class="close">X</a>
<div id="slideShow">
<?php the_gallery(); ?>
</div>
関数the_gallery()
はリンク付きの画像の単なるループです:<a rel="fancybox"><img/></a>
編集: 06.09.12
ギャラリー機能は添付ファイルプラグインで動作します
function the_gallery() {
$attachments = attachments_get_attachments();
$total_attachments = count($attachments);
if( $total_attachments > 0 )
{
for ($i=0; $i < $total_attachments; $i++)
{
$url = wp_get_attachment_image( $attachments[$i]['id'],
'bullet-event');
$lrgurl = wp_get_attachment_image_src( $attachments[$i]['id'], 'large' );
echo '
<a href="'.$lrgurl[0].'"
rel="#overlay" title="'.$attachments[$i]['title'].'">
' . $url . '
</a> ';
}
}
}
単一の.php内のjqueryは次のとおりです。
var wrapEveryN = function(n, elements, wrapper) {
for (var i=0; i< elements.length; i+=n) {
elements.slice(i,i+n).wrapAll(wrapper);
}
}
wrapEveryN( 12, $("#slideShow a"), '<div></div>' );
$('#slideShow').cycle({
fx: 'scrollLeft'
});
ここで問題が発生します。画像ギャラリー(サイクル)とファンシーボックスとスタイルを管理する必要があるシングル内で...正しく表示されるのはスタイルだけですが、jsが機能しない理由がわかりません:
すべてのコードとプラグインはplugins.php
&にありますmain.php