Last active
September 14, 2017 08:36
Revisions
-
Ihor revised this gist
Sep 14, 2017 . 2 changed files with 18 additions and 25 deletions.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,4 @@ <?php /*IS NOT WOOCOMMERCE*/ if ( ! function_exists( 'is_ajax' ) ) { /** @@ -8,23 +9,17 @@ function is_ajax() { return defined( 'DOING_AJAX' ); } } //FUNCTIONS AJAX add_action( 'wp_ajax_loadPosts', 'loadPosts'); add_action( 'wp_ajax_nopriv_loadPosts', 'loadPosts'); function loadPosts($paged = 1){ extract($_POST); //show post if (is_ajax()) { exit(); } } //FUNCTIONS VARIABLES JS function js_variables(){ $variables = array ( @@ -36,22 +31,4 @@ function js_variables(){ ';</script>' ); } add_action('wp_head','js_variables'); This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,16 @@ $(document).on("click", "#button", function(){ var ajaxcontent = $('.products'); $.ajax({ type: 'POST', url: window.wp_data.ajax_url, data: { action: "loadPosts", }, success: function (html) { ajaxcontent.html(html); } }); return false; }); -
Ihor revised this gist
Sep 14, 2017 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -14,7 +14,7 @@ if ( ! function_exists( 'is_ajax' ) ) { //FUNCTIONS AJAX add_action( 'wp_ajax_loadPosts', 'loadPosts'); add_action( 'wp_ajax_nopriv_loadPosts', 'loadPosts'); function loadPosts($paged = 1){ extract($_POST); //show post -
Ihor revised this gist
Sep 14, 2017 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -17,7 +17,8 @@ add_action( 'wp_ajax_nopriv_loadPosts', 'loadPosts'); function loadloadPosts($paged = 1){ extract($_POST); //show post if (is_ajax()) { exit(); } -
Ihor revised this gist
Sep 14, 2017 . 1 changed file with 7 additions and 8 deletions.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -12,9 +12,9 @@ if ( ! function_exists( 'is_ajax' ) ) { //FUNCTIONS AJAX add_action( 'wp_ajax_loadPosts', 'loadPosts'); add_action( 'wp_ajax_nopriv_loadPosts', 'loadPosts'); function loadloadPosts($paged = 1){ extract($_POST); echo 'test'; @@ -40,18 +40,17 @@ add_action('wp_head','js_variables'); //JS var ajaxcontent = $('.products'); $.ajax({ type: 'POST', url: window.wp_data.ajax_url, data: { action: "loadPosts", }, success: function (html) { ajaxcontent.html(html); } }); return false; -
moskalukigor revised this gist
Apr 7, 2017 . 1 changed file with 3 additions and 1 deletion.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -46,7 +46,9 @@ var form = $('.filtering > form'), $.ajax({ type: 'POST', url: window.wp_data.ajax_url, data: { action: "loadMorePosts", }, success: function (html) { ajaxcontent.html(html); } -
moskalukigor revised this gist
Dec 29, 2016 . 1 changed file with 0 additions and 1 deletion.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -49,7 +49,6 @@ $.ajax({ data: form.serialize() + "&category="+category, success: function (html) { ajaxcontent.html(html); } }); -
moskalukigor revised this gist
Dec 6, 2016 . 1 changed file with 1 addition and 40 deletions.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -17,46 +17,7 @@ add_action( 'wp_ajax_nopriv_loadSticker_ajax', 'loadSticker_ajax'); function loadSticker_ajax($paged = 1){ extract($_POST); echo 'test'; if (is_ajax()) { exit(); } -
moskalukigor revised this gist
Nov 10, 2016 . 1 changed file with 0 additions and 2 deletions.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -89,8 +89,6 @@ $.ajax({ success: function (html) { ajaxcontent.html(html); } } }); -
moskalukigor revised this gist
Nov 10, 2016 . 1 changed file with 3 additions and 0 deletions.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -79,6 +79,9 @@ add_action('wp_head','js_variables'); //JS var form = $('.filtering > form'), ajaxcontent = $('.products'); $.ajax({ type: 'POST', url: window.wp_data.ajax_url, -
moskalukigor revised this gist
Nov 10, 2016 . 1 changed file with 13 additions and 0 deletions.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,16 @@ /*IS NOT WOOCOMMERCE*/ if ( ! function_exists( 'is_ajax' ) ) { /** * is_ajax - Returns true when the page is loaded via ajax. * @return bool */ function is_ajax() { return defined( 'DOING_AJAX' ); } } //FUNCTIONS AJAX add_action( 'wp_ajax_loadSticker_ajax', 'loadSticker_ajax'); add_action( 'wp_ajax_nopriv_loadSticker_ajax', 'loadSticker_ajax'); -
moskalukigor renamed this gist
Nov 10, 2016 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
moskalukigor created this gist
Nov 10, 2016 .There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,81 @@ //FUNCTIONS AJAX add_action( 'wp_ajax_loadSticker_ajax', 'loadSticker_ajax'); add_action( 'wp_ajax_nopriv_loadSticker_ajax', 'loadSticker_ajax'); function loadSticker_ajax($paged = 1){ extract($_POST); $tax_query = ""; $orderby = "date"; $order = "DESC"; if($category != "*" && $category != null) { $tax_query = array( 'relation' => 'AND', array( 'taxonomy' => 'product_cat', 'field' => 'slug', 'terms' => array($category) ), ); } $args = array( 'posts_per_page' => 12, 'paged' => $paged, 'tax_query' => $tax_query, 'post_type' => 'product', 'post_status' => 'publish', 'orderby' => $orderby, 'order' => $order ); $products = new WP_Query( $args ); $num_pages = $products->max_num_pages; if($products->have_posts()) { while ( $products->have_posts() ) { $products->the_post(); wc_get_template_part( 'content', 'product' ); } if ($num_pages != $paged) { echo "<div class='for_button'><div class='button empty loadMore' data-href=". ($paged + 1) ." data-category=".$category.">Load More</div></div><div class='for_loader'>". get_loader() ."</div>"; } } else { echo '<div><p class="custom_coming_soon">Coming <span>Soon!</span></p></div>'; } if (is_ajax()) { exit(); } } //FUNCTIONS VARIABLES JS function js_variables(){ $variables = array ( 'ajax_url' => admin_url('admin-ajax.php'), ); echo( '<script type="text/javascript">window.wp_data = '. json_encode($variables). ';</script>' ); } add_action('wp_head','js_variables'); //JS $.ajax({ type: 'POST', url: window.wp_data.ajax_url, data: form.serialize() + "&category="+category, success: function (html) { ajaxcontent.html(html); } //animation end here $('.add_to_cart_button:not(.product_type_variable)').attr('data-remodal-target', 'product_popup'); } }); return false;