Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function maxive_ajax_pf_load_more(){
- $ppp = isset( $_POST['ppp'] ) ? $_POST['ppp'] : 3;
- $paged = isset( $_POST['page'] ) ? $_POST['page'] : 2;
- $paged++;
- $args = array(
- 'post_type' => 'portfolio',
- 'posts_per_page' => $ppp,
- 'paged' => $paged,
- );
- $posts = new WP_Query($args);
- if( $posts->have_posts() ) :
- while( $posts->have_posts() ) :
- $posts->the_post();
- // Get taxonomies for single portfolio posts
- $types = get_the_terms( $posts->ID, 'portfolio-type' );
- $typesCount = count( $types );
- $count = 0;
- $termArr = array();
- // Loop over throuth each the terms
- if( $types ) {
- foreach($types as $type) {
- $termArr[] = strtolower( $type->name ) ;
- }
- }
- ?>
- <!-- contents will be ecohing from here. -->
- <?php
- endwhile;
- wp_reset_postdata();
- endif;
- die();
- }
- add_action('wp_ajax_nopriv_maxive_ajax_pf_load_more', 'maxive_ajax_pf_load_more');
- add_action('wp_ajax_maxive_ajax_pf_load_more', 'maxive_ajax_pf_load_more');
Advertisement
Add Comment
Please, Sign In to add comment