<a href="https://wordpress.stackexchange.com/questions/77197/<?php bloginfo("template_url'); ?>/auction_price.php">Order by price</a>
auction-price.php
is inside the template directory.
Then you can’t include wp-blog-header.php
using require(‘./wp-blog-header.php’) inside template directory.
Therefore do_shortcode() is not working without WordPress.
The proper way to use ajax in WordPress is via admin-ajax.php
Read More at Codex:
http://codex.wordpress.org/AJAX_in_Plugins
For example, in your functions.php
:
function wpse_77197_auction_price(){
echo do_shortcode('[wpa_list_widget mode="list" order="price"]');
die();
}
add_action('wp_ajax_price_action', 'wpse_77197_auction_price');
add_action('wp_ajax_nopriv_price_action', 'wpse_77197_auction_price');
In your template file:
<div id="tabs">
<ul>
<li><a href="#tabs-1">Order by date</a></li>
<li><a href="<?php echo admin_url('admin-ajax.php'); ?>?action=price_action">Order by price</a></li>
</ul>
<div id="tabs-1">
<?php echo do_shortcode('[wpa_list_widget mode="list" order="date"]'); ?>
</div>
</div>
Update:
Try to handle the ajax request yourself in the “wp” or “init” action as explained in https://wordpress.stackexchange.com/a/53491/19683
add_action( 'init', function() {
wpse_77197_register_shortcode_ajax( 'wpse_77197_auction_price', 'price_action' );
} );
function wpse_77197_register_shortcode_ajax( $callable, $action ) {
if ( empty( $_POST['action'] ) || $_POST['action'] != $action )
return;
call_user_func( $callable );
}
function wpse_77197_auction_price(){
echo do_shortcode('[wpa_list_widget mode="list" order="price"]');
die();
}