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 characters
<?php | |
function dw_product_totals() { | |
global $wpdb; | |
$post = get_post( $post_id ); | |
$current_product = get_the_ID($post); | |
$order_items = apply_filters( 'woocommerce_reports_top_earners_order_items', $wpdb->get_results( " |
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 characters
jQuery(function($){ | |
$('#filter').change(function(){ | |
var filter = $('#filter'); | |
$.ajax({ | |
url:filter.attr('action'), | |
data:filter.serialize(), // form data | |
type:filter.attr('method'), // POST | |
beforeSend:function(xhr){ | |
//filter.find('button').text('Processing...'); // changing the button label | |
$('#appendTable').html('<label class="alert">Processing...</label>'); |
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 characters
<?php | |
global $post; | |
$args = array( | |
'post_type' => 'page', //write slug of post type | |
'posts_per_page' => -1, | |
'post_parent' => $post->ID, //place here id of your parent page | |
'order' => 'ASC', | |
'orderby' => 'menu_order', | |
); | |
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 characters
<div id='long'></div> | |
<div id='long'></div> | |
<pre id="response"></pre> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> | |
<script> | |
$.get("https://api.ipdata.co/?api-key=test", function (response) { | |
$("#response").html(JSON.stringify(response, null, 4)); | |
$("#long").html(response.latitude + ", " + response.longitude); | |
$("#long").html(response.city + ", " + response.longitude); |
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 characters
//Place this code in functions.php | |
//add the ajax fetch js | |
add_action( 'wp_footer', 'ajax_fetch' ); | |
function ajax_fetch() { | |
?> | |
<script type="text/javascript"> | |
function fetch(){ | |
jQuery.ajax({ | |
url: '<?php echo admin_url('admin-ajax.php'); ?>', |
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 characters
add_action('wp_footer', 'ajax_product_fetch'); | |
function ajax_product_fetch() | |
{ | |
?> | |
<script type="text/javascript"> | |
function product_fetch() { | |
jQuery.ajax({ | |
url: '<?php echo admin_url('admin-ajax.php'); ?>', | |
type: 'post', | |
data: {action: 'product_fetch', product_keyword: jQuery('#product_keyword').val()}, |
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 characters
<?php | |
global $post; | |
function get_all_subpages($page, $args = '', $output = OBJECT) { | |
// Validate 'page' parameter | |
if (! is_numeric($page)) | |
$page = 0; | |
// Set up args | |
$default_args = array( | |
'post_type' => 'page', |
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 characters
<?php | |
add_action( 'restrict_manage_posts', 'filter_backend_by_taxonomies' , 99, 2); | |
/* Filter CPT via Custom Taxonomy */ | |
/* https://generatewp.com/filtering-posts-by-taxonomies-in-the-dashboard/ */ | |
function filter_backend_by_taxonomies( $post_type, $which ) { | |
// Apply this to a specific CPT | |
if ( 'team' !== $post_type ) | |
return; |
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 characters
<div class="wrapper-dropdown"> | |
<form class="woocommerce-ordering" method="get"> | |
<select name="orderby" class="orderby filter_orderby" aria-label="Shop order"> | |
<?php | |
$catalog_orderby = apply_filters( 'woocommerce_catalog_orderby', array( | |
'menu_order' => __( 'Default sorting', 'woocommerce' ), | |
'popularity' => __( 'Sort by popularity', 'woocommerce' ), | |
'rating' => __( 'Sort by average rating', 'woocommerce' ), |
OlderNewer