以前にこれに関するいくつかの問題を見たことがありますが、石積みのスクリプト内では、正しい軌道に乗っているかどうかわかりません。
結果: コンテンツを div にロードしようとすると、リンクによってまったく新しいページが開きます。
index.php コード:
<div id="primary" class="site-content">
<div id="content" role="main">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div id="miniLoader"></div>
<div class="box">
<a class="miniLoader" href="<?php the_permalink() ?>">
<?php if (has_post_thumbnail()) {
the_post_thumbnail('thumbnail');
}?>
<h2><?php the_title(); ?></h2></a>
</div>
<?php endwhile; endif; ?>
<?php get_footer(); ?>
header.php コード:
<script>
jQuery(document).ready(function($){
$('#container').masonry({
itemSelector: '.box',
});
});
</script>
<?php wp_head(); ?>
<script type="text/javascript"
src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$.ajaxSetup({cache:false});
$(".miniLoader").click(function(){
var post_id = $(this).attr("href")
$("#miniLoader").html("loading...");
$("#miniLoader").load(post_link);
return false;
});
});
私の知る限り、配置はループ内にあり、スクリプトはあるべき場所に収まります。それとも、配置と「rel」について悪いアドバイスを受けていますか? html5 と wordpress 3.5 では「rel」を使用しないと聞いたことがあります...
どんな助けでも大歓迎です!
(これを理解するためにパズルのピースが欠けている場合はお知らせください)