saurav.rox
Forum Replies Created
-
Forum: Developing with WordPress
In reply to: WP Media Uploader Unselect Image on close@bcworkz can you please help me on this?
Forum: Fixing WordPress
In reply to: Custom form with stripe gatewayHello,
I am not appending the stripe html part directly, I am appending it via ajax. Is it not possible to run my validation code first before the stripe pop-form appears?Forum: Fixing WordPress
In reply to: Custom form with stripe gatewayHello @bcworkz,
Thanks for replying.As you can see that the stripe Pay button has its own script like this:
<script src="https://checkout.stripe.com/checkout.js" class="stripe-button active" data-key="" data-panel-label="Pay" data-amount="100000" data-name="new trip" data-currency="USD" data-label="Pay"></script> <button type="submit" class="stripe-button-el" style="visibility: visible;"> <span style="display: block; min-height: 30px;">Pay</span></button>
How can I prevent default on that? Once it is clicked, the form is automatically submitted. My validation js code does not work. ??
Forum: Fixing WordPress
In reply to: Custom form with stripe gatewayHello @bcworkz,
Thanks for replying.I tried validating the form or checking if any form details is missing via Javascript.
But if the form is left blank and Pay button is pressed then that validation doesnot work. The form is being submitted automatically after the Pay button is pressed without the validation.Can you please help me on this?
Forum: Developing with WordPress
In reply to: Ajax Load More on Hierarchical Taxonomy TermsThank you again @bcworkz,
Closing this ticket and marking as resolved.Forum: Developing with WordPress
In reply to: Ajax Load More on Hierarchical Taxonomy TermsHello,
I did it myself ?? I was able to do it the other way around. Any ways, thanks you for the support. You really are a WordPress guru.CHEERS!
Forum: Developing with WordPress
In reply to: Ajax Load More on Hierarchical Taxonomy TermsHello @bcworkz,
Thank your for your explanation. I was able to run the pagination correctly for each of the terms independently. The methods you instructed me were quiet easy to implement.
Thank You again.
The last thing I’m stuck is on the post repeat. I want to show fixed number of posts on load more when load more is clicked. I’m able to control the number of posts to load at a time but what i’m getting is repeated posts on each load. That means the posts that are shown on page load gets loaded again on load more click. I tried usingoffset
parameter but couldn’t get it done properly.
This is what I have done:$display_count = $default_posts_per_page; //from reading settings number of posts // Next, get the current page $page = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1; //tried using page from ajax too // After that, calculate the offset $offset = ( $page - 1 ) * $display_count; $args = array( 'post_type' => 'trip', // Your Post type Name that You Registered 'order' => 'ASC', 'tax_query' => array( array( 'taxonomy' => $keys[0], //activities taxonomy 'field' => 'slug', 'terms' => $_POST['second_class'], //term slug from ajax 'include_children' => false ) ), 'number' => $display_count, 'page' => $page, 'offset' => $offset );
Can you please help me on this last query?
Forum: Developing with WordPress
In reply to: Ajax Load More on Hierarchical Taxonomy TermsHello,
Thank you for pointing me in right direction. I have understood what you are trying to suggest me. So far you have helped me a lot. But now I want some more help from you ?? . Okey, so I tried running the pagination independently but couldn’t get it done properly.
Can I run multiple functions as a callback on WordPress ajax like this? Or, how can I localize the variables dynamically so that I can control thepage
argument?$this->loader->add_action( 'wp_ajax_wpte_ajax_load_more', $plugin_public, 'wpte_be_load_more_js' ); $this->loader->add_action( 'wp_ajax_nopriv_wpte_ajax_load_more', $plugin_public, 'wpte_be_load_more_js' ); $this->loader->add_action( 'wp_ajax_wpte_ajax_load_more', $plugin_public, 'wpte_ajax_load_more' ); $this->loader->add_action( 'wp_ajax_nopriv_wpte_ajax_load_more', $plugin_public, 'wpte_ajax_load_more' );
I also tried to save
page
for each of the terms in session but couldn’t get it done.
Would you please help me some more? It would be really appreciable.Thank you so much!
Forum: Developing with WordPress
In reply to: Ajax Load More on Hierarchical Taxonomy TermsWould you please take a look at my code? Thank you!
function wpte_be_load_more_js() { global $wp_query; if(!isset(get_queried_object()->slug)) return; $wte_trip_cat_slug = get_queried_object()->slug; if ( isset($_POST['second_class']) && $_POST['second_class']!= $wte_trip_cat_slug ) { $wte_trip_cat_slug = $_POST['second_class']; } $args = array( 'nonce' => wp_create_nonce( 'be-load-more-nonce' ), 'url' => admin_url( 'admin-ajax.php' ), 'query' => $wp_query->query, 'slug' => $wte_trip_cat_slug, 'current_page' => isset($_POST['page']) ? esc_attr($_POST['page']) : 1, 'max_page' => $wp_query->max_num_pages ); wp_enqueue_script( 'be-load-more', plugin_dir_url( __FILE__ ) . 'js/load-more.js', array( 'jquery' ), '1.0', true ); wp_localize_script( 'be-load-more', 'beloadmore', $args ); } /** * AJAX Load More * */ function wpte_ajax_load_more() { check_ajax_referer( 'be-load-more-nonce', 'nonce' ); $wp_travel_engine_setting_option_setting = get_option( 'wp_travel_engine_settings', true ); $keys=array_keys($_POST['query']); $args = array( 'post_type' => 'trip', // Your Post type Name that You Registered 'order' => 'ASC', 'tax_query' => array( array( 'taxonomy' => $keys[0], 'field' => 'slug', 'terms' => $_POST['second_class'], 'include_children' => true ) ), 'paged' => $_POST['page'] ); ob_start(); $loop = new WP_Query( $args ); if( $loop->have_posts() ): while( $loop->have_posts() ): $loop->the_post(); global $post; $wp_travel_engine_setting = get_post_meta( $post->ID,'wp_travel_engine_setting',true );?> <div class="col"> <div class="img-holder"> <a href="<?php echo esc_url( get_the_permalink() );?>" class="trip-post-thumbnail"><?php $trip_feat_img_size = apply_filters('wp_travel_engine_archive_trip_feat_img_size','destination-thumb-trip-size'); $feat_image_url = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), $trip_feat_img_size ); if(isset($feat_image_url[0])) { ?> <img src="<?php echo esc_url( $feat_image_url[0] );?>"> <?php } else{ echo '<img src="'.esc_url( WP_TRAVEL_ENGINE_IMG_URL . '/public/css/images/trip-listing-fallback.jpg' ).'">'; }?> </a> <?php $code = 'USD'; if( isset($wp_travel_engine_setting_option_setting['currency_code']) && $wp_travel_engine_setting_option_setting['currency_code']!='') { $code = esc_attr( $wp_travel_engine_setting_option_setting['currency_code'] ); } $obj = new Wp_Travel_Engine_Functions(); $currency = $obj->wp_travel_engine_currencies_symbol( $code ); $cost = isset( $wp_travel_engine_setting['trip_price'] ) ? $wp_travel_engine_setting['trip_price']: ''; $prev_cost = isset( $wp_travel_engine_setting['trip_prev_price'] ) ? $wp_travel_engine_setting['trip_prev_price']: ''; $code = 'USD'; if( isset( $wp_travel_engine_setting_option_setting['currency_code'] ) && $wp_travel_engine_setting_option_setting['currency_code']!= '' ) { $code = $wp_travel_engine_setting_option_setting['currency_code']; } $obj = new Wp_Travel_Engine_Functions(); $currency = $obj->wp_travel_engine_currencies_symbol( $code ); $prev_cost = isset($wp_travel_engine_setting['trip_prev_price']) ? $wp_travel_engine_setting['trip_prev_price']: ''; if( $cost!='' && isset($wp_travel_engine_setting['sale']) ) { $obj = new Wp_Travel_Engine_Functions(); echo '<span class="price-holder"><span>'.esc_attr($currency).esc_attr( $obj->wp_travel_engine_price_format($cost) ).'</span></span>'; } else{ $obj = new Wp_Travel_Engine_Functions(); echo '<span class="price-holder"><span>'.esc_attr($currency).esc_attr( $obj->wp_travel_engine_price_format($cost) ).'</span></span>'; } ?> </strong> </div> <div class="text-holder"> <h3 class="title"><a href="<?php echo esc_url( get_the_permalink() );?>"><?php the_title();?></a></h3> <?php $nonce = wp_create_nonce( 'wp-travel-engine-nonce' ); ?> <?php if( isset( $wp_travel_engine_setting['trip_duration'] ) && $wp_travel_engine_setting['trip_duration']!='' ) { ?> <div class="meta-info"> <span class="time"> <i class="fa fa-clock-o"></i> <?php echo esc_attr($wp_travel_engine_setting['trip_duration']); if($wp_travel_engine_setting['trip_duration']>1){ _e(' days','wp-travel-engine');} else{ _e(' day','wp-travel-engine'); } ?> </span> </div> <?php } ?> <div class="btn-holder"> <a href="<?php echo esc_url( get_the_permalink() );?>" class="btn-more"><?php _e('View Detail','wp-travel-engine');?></a> </div> </div> </div> <?php endwhile; wp_reset_postdata(); endif; wp_reset_query(); $data = ob_get_clean(); wp_send_json_success( $data ); exit; } $this->loader->add_action( 'wp_ajax_wpte_ajax_load_more', $plugin_public, 'wpte_be_load_more_js' ); $this->loader->add_action( 'wp_ajax_nopriv_wpte_ajax_load_more', $plugin_public, 'wpte_be_load_more_js' ); $this->loader->add_action( 'wp_ajax_wpte_ajax_load_more', $plugin_public, 'wpte_ajax_load_more' ); $this->loader->add_action( 'wp_ajax_nopriv_wpte_ajax_load_more', $plugin_public, 'wpte_ajax_load_more' );
And here is my javascript:
jQuery(document).ready(function($){ var loading = false; $('body').on('click', '.btn-loadmore', function (e){ var second_class = $(this).parent().attr('class').split(' ')[1]; loading = true; // beloadmore.current_page++; var data = { action: 'wpte_ajax_load_more', nonce: beloadmore.nonce, page: beloadmore.current_page, query: beloadmore.query, second_class : second_class }; $.post(beloadmore.url, data, function(res) { if( res.success) { $('.'+data.second_class+' .btn-loadmore').before( res.data ); beloadmore.current_page++; if( beloadmore.current_page == beloadmore.max_page ) { $('.'+data.second_class+' .btn-loadmore').remove(); } } else { $('.'+data.second_class+' .btn-loadmore').remove(); } }).fail(function(xhr, textStatus, e) { return false; }); }); });
Forum: Fixing WordPress
In reply to: WordPress Paypal IntegrationHello,
Thanks for replying but my question is how to change sandbox mode to live mode? Is it enough just changing the form’s action to paypal live ( paypal.com/cgi-bin/webscr ) from sandbox link or something more is required?Forum: Reviews
In reply to: [WP Edit Menu] Very Nice Plugin for editing menu.Hello @lamarajan,
Thanks for your nice feedback as well as for the rating.Hello @kzeni,
Thanks for your feedback as well as requests. I would to surely love to cover them in the next version of the plugin.Kind regards,
Forum: Plugins
In reply to: [Customizer Export/Import] Importing errorHello,
I was able to solve this by using double quote(“) properly. I used it like this:[contact-form-7 id=\"21\" title=\"Contact form 1\"]
which means double quote inside double quote was causing the error.
Thanks!Forum: Plugins
In reply to: [One Click Demo Import] Multiple Demo ImportHello,
After spending sometime on this, I found that the shortcode that was given as an input in customizer was causing the issue. Because of which there was double quote(“) inside double quote(“) and that had caused that error. So, I changed it like this:[contact-form-7 id=\"21\" title=\"Contact form 1\"]
and got my issue resolved.Anyways, thanks for your support and for this helpful plugin.
I am gonna rate your plugin 5 stars ??Thanks,
Forum: Plugins
In reply to: [One Click Demo Import] Multiple Demo ImportHello,
I exported my customizer settings using the plugin you suggested and tried to import it using the same plugin. But while importing it shows the following error:
“Error importing settings! Please check that you uploaded a customizer export file.”I have already opened a ticket in that plugin’s support forum. And waiting for their reply.
Also I would like to know what sort of special characters are you trying to mention? I have just made a demo of my theme and then exported using that plugin.Also I would like to share something with you. I have kept characters like ‘@’, ‘+’, ‘-‘ in the input fields of customizer where email or phone is to be filled up. Is that something you are trying to point?
Would you please explain a bit?
It would be really nice of you.
Thanks again!
- This reply was modified 7 years, 11 months ago by saurav.rox.