Use ajax response in PHP function

Instead of cooking up your own PHP file and trying to bring in WordPress functionality, put the functionality inside of WordPress using the AJAX hooks that are designed to do that sort of thing. More info here: http://codex.wordpress.org/AJAX_in_Plugins

Loop on a wordpress Page instead of content coming from the WP text editor

On your custom page template, the default loop is working and that’s why the loop is fetching content from the page. You need a custom query in this case. Here’s the code. <?php $query = new WP_Query( array( ‘post_type’ => ‘post’, ‘post_status’ => ‘publish’, ) ); if ( $query->have_posts() ) { while ( $query->have_posts() ) … Read more

Check if username doesn’t exists

Got it fixed. Pretty simple actually. I moved the if part where the user get’s deleted to the bottom of the script. foreach ($data as $gebruiker){ $username = $gebruiker[‘username’]; if ( username_exists( $username ) && $gebruiker[‘status’] == ‘published’ ){ $user = get_user_by( ‘login’, $username); update_user_meta( $user->ID, ‘import_1′, $gebruiker[’email’] ); }else{ $users = wp_insert_user( array( ‘user_login’ … Read more

using a shortcode in a hyperlink

Don’t use double quotes (“) inside the shortcode, since you are using double quotes to specify the href attribute. The browser thinks your href text ends at position=. Use single quotes instead: href=”https://wordpress.stackexchange.com/reservation/?unitrate=[print_csv position=”5′]&amp;… I agree with the comments that there is a better way to do this, but I provide a potential answer anyway … Read more

How to code bulk order form in wordpress

Yes definitely. You can create a form with data grid with option to add rows using javascript in realtime. Once the form is submitted you can import each row into WP Post table with post type ‘products’. Let me know if you need further help.

I am unable to fetch json data from wp_db

$user1 = $wpdb->get_results(“SELECT * FROM diary_user_form_storage”); foreach ($user1 as $key => $value) { $productString = stripslashes($value->product); $product=json_decode($productString,true); $error_p = implode(‘ ‘, $product[0]); echo $error_p; } Out will be PRODUCT 2 PRODUCT 5