2 Star 0 Fork 0

刻意练习/fullpageDemo

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
pro_list.php 2.25 KB
一键复制 编辑 原始数据 按行查看 历史
刻意练习 提交于 2018-06-17 08:37 . wjj
<?php
/*
* Template Name: pro_list
*/
?>
<?php
get_header();
?>
<div class="page2 pro-list">
<div class="wrap clearfix">
<div class='pro-list-wrap clearfix' id="article-list">
<?php
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$posts_per_page = get_category(get_query_var('cat'))->category_parent == 0 ? 999 : 999;
// exit;
$args = array(
'caller_get_posts' => 1,
'cat' => get_query_var('cat'),
'paged' => $paged,
'posts_per_page' => $posts_per_page,
);
query_posts($args);
while (have_posts()) {
the_post();
?>
<div class="pro-item article-item">
<a href="<?php echo home_url('index.php/detail/?post_id=' . $post->ID); ?>" class='link-wrap'>
<div class="pic-wrap">
<?php if (has_post_thumbnail()) {
the_post_thumbnail('pro');
} else {?>
<img src="<?php bloginfo('template_url');?>/images/dot.jpg" alt="..." />
<?php }?>
</div>
<div class="title"><?php the_title();?></div>
<div class='desc'>
<?php echo get_post_meta($post->ID, 'desc', true); ?>
</div>
</a>
</div>
<?php
}
?>
</div>
<?php
wp_reset_query();
?>
</div>
</div>
<script>
$('loading')
$('.article-paging > a').on('click',function(){ //点击实现加载更多,你可以根据自己需要改成下拉自动加载
var next_url = $(this).attr("href");
var next_text = $(this).text();
$.ajax({
type: 'get',
url: next_url + '#article-list',
success: function(data){
result = $(data).find("#article-list .article-item");
next_link = $(data).find(".article-paging > a").attr("href");
//$(this).attr("href", next_url);
if (next_link != undefined){
$('.article-paging > a').attr("href", next_link);
}else{
$(".loading-more").remove();
}
console.log(result);
$(function(){
$("#article-list").append(result.css({display: 'inline-block'}).fadeIn(300));
$('.thumb').lazyload({
data_attribute: 'src',
placeholder: _BGJ.uri + '/static/img/thumbnail.png',
threshold: 400
});
});
$(function() {
if (next_url.indexOf("page") < 1) {
$("#article-list").html('');
}
$("#article-list").append(result.fadeIn(200));
});
}
});
return false;
});
</script>
<?php
get_footer();
?>
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/can_contact/fullpageDemo.git
git@gitee.com:can_contact/fullpageDemo.git
can_contact
fullpageDemo
fullpageDemo
master

搜索帮助