1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
|
/****************************************************************************************************************************/
function child_enqueue_js_files() {
wp_enqueue_script('child-jquery', get_stylesheet_directory_uri() . "/js/jquery-1.11.3.js");
wp_enqueue_script( 'script', get_stylesheet_directory_uri().'/js/script.js',array('child-jquery'), '1.0', true );
// pass Ajax Url to script.js
wp_localize_script('script', 'ajaxurl', admin_url( 'admin-ajax.php' ) );
}
add_action('wp_enqueue_scripts', 'child_enqueue_js_files');
/* End Enqueue Javascript Files */
<?php
/****************************************************************************************************************************/
add_action( 'wp_ajax_load_more', 'load_more' );
add_action( 'wp_ajax_nopriv_load_more', 'load_more' );
function load_more() {
global $argscarousel;
global $ajax_query;
$posttype = $_POST['post_type'];
//$catname=$_POST['category'];
//$taxonomy = $_POST['taxonomy'];
//$term = $_POST['term'];
if ($posttype=='page'){
$args = array(
//'post_parent' => $post->post_parent,
'post_status' => array('inherit','publish'),
'post_type' => $posttype,
//'post_mime_type' => array('image','text/plain'),
'order' => 'ASC',
'orderby' => 'menu_order ID none',
'showposts'=>-1
);
}else {
$args = array(
//'post_parent' => $post->post_parent,
'post_status' => array('inherit','publish'),
'post_type' => $posttype,
'tax_query' => array(
'relation' => 'OR',
array(
'taxonomy' => 'category',
'field' => 'slug',
'terms' => array('non-classe'),
),
array(
'taxonomy' => 'attachment_category',
'field' => 'slug',
'terms' => array('media00'),
),
array(
'taxonomy' => 'none',
'field' => 'slug',
'terms' => '',
)
),
//'post_mime_type' => array('image','text/plain'),
'order' => 'ASC',
'orderby' => 'menu_order ID none',
'showposts'=>-1
);
}
//wp_reset_query();
//wp_reset_postdata();
$argscarousel=$args;
$ajax_query = new WP_Query($args);
echo '<h2> je suis dans la fonction php loadmore</h2>';
if ( $ajax_query->have_posts() ) :
while ( $ajax_query->have_posts() ) : $ajax_query->the_post();
get_template_part( 'article' );
//get_template_part('content','carousel');
endwhile;
endif;
die();
}
?> |