pass wordpress template directory into ajax url call

I suspect you don’t want to hardcode your URL to data.php, but using a standalone file to handle requests in a theme or plugin is a major security problem. Instead, using a REST API endpoint. For example, lets register a data endpoint: add_action( ‘rest_api_init’, function () { register_rest_route( ‘monacoder/v1’, ‘/data/’, array( ‘methods’ => ‘POST’, ‘callback’ … Read more

How to insert class in each list of categories?

Why don’t you use get_categories instead. Here is an example: $categories = get_categories(); $output=””; if($categories) { $output = “<ul class=”list-inline”>”; foreach($categories as $category) { $output .= ‘<li class=”list-inline-item”><a href=”‘.get_category_link( $category->term_id) . ‘”>’.$category->cat_name.'</a></li>’; } $output .= “</ul>”; } echo $output; Head over here for more available modification options

Adding an external link to product grid list pages for woocommerce

A possible hook to position a button in that point is woocommerce_after_shop_loop_item: add_action(“woocommerce_after_shop_loop_item”,”Stack_308575_add_button”,99); function Stack_308575_add_button(){ global $product; echo “<button onclick=\”alert(“.wc_get_product($product)->id.”)\”>Click</button>”; } If you need dynamic links you can get the global $product object and retrieve data from there

How to use ajax in wordpress and sending the data without refreshing ?

Hope this will help you .. +1 for this if you understand. First step //yours dynamic dropdown field <select id=”customers”> <option value=”None Selected”></option> <?PHP $customers = $wpdb->get_results(“SELECT * FROM _cif_customers_table;”); foreach ($customers as $customer) { echo ‘<option value=”‘.$customer->id.'”>’.$customer->company.'</option>’; } ?> </select> Second step : //your customer data will show after fetch the data from customer … Read more