Load more using selected Tab
-
hello i use load more functionality for tab. i crete this code its true or false?
<div class=”showall”> Load more </div>
<script>
function loadmore_portfolio(ref){var selected_tab = $(‘li’).find(‘a.selected’).attr(‘id’);
var list = [];
$(‘#apendata-‘+selected_tab+’ li’).each(function() {
var id = $(this).attr(‘id’).split(‘-‘)[1];
list.push(id);
//alert(id);
});
$.ajax({
url:'<?php echo get_permalink(35); ?>’,
type:’post’,
data: {selected_tab:selected_tab,list:list},
success:function(resp){
if(resp.trim()==”){
//$(‘.showall’).css(‘display’,’none’);
$(ref).remove();
}
var selected_tab = $(‘li’).find(‘a.selected’).attr(‘id’);
$(‘#apendata-‘+selected_tab).append(resp);}
});
}
</script>And then other page i add this
$selected_tab = $_REQUEST[‘selected_tab’];
$exclude_post = $_REQUEST[‘list’];
$tax = “portfolio_taxonomy”;//$data = get_term_by($field, $value, $taxonomy);
$termname = get_term_by( ‘id’, $selected_tab, $tax );
//echo “"; print_r($termname); $term= get_term( $selected_tab, 'portfolio_taxonomy' ); $argssss = new wp_query(array( 'post_type' => 'portfolio', 'posts_per_page' => 2, "$tax" => $termname->slug, 'order' => 'ASC', 'orderby' => 'date', 'post__not_in' => $exclude_post, 'post_status' => 'publish' )); while($argssss->have_posts()): $argssss->the_post();
- The topic ‘Load more using selected Tab’ is closed to new replies.