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 | |
/** | |
* BuddyBoss Country Field | |
* Create and autocomplete dropdown "Country" field | |
* After the field has been created, delete this code | |
*/ | |
function bp_add_custom_country_list() | |
{ |
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
global $wpdb; | |
$today_start = date('Y-m-d H:i:s', strtotime('yesterday 9pm')); | |
$today_end = date('Y-m-d H:i:s', strtotime('today 9pm')); | |
$SQL_ACF_TODAY = "SELECT $wpdb->posts.id FROM $wpdb->posts | |
LEFT JOIN $wpdb->postmeta | |
ON $wpdb->postmeta.post_id = $wpdb->posts.ID | |
WHERE 1 = 1 | |
AND $wpdb->posts.post_type = 'post' | |
AND $wpdb->posts.post_status = 'publish' |
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
/** | |
* AJAX Custom Signup | |
*/ | |
add_action('wp_ajax_es_mepr_signup_toggle_form', 'es_mepr_signup_toggle_form_callback'); | |
add_action('wp_ajax_nopriv_es_mepr_signup_toggle_form', 'es_mepr_signup_toggle_form_callback'); | |
function es_mepr_signup_toggle_form_callback() | |
{ |
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 | |
$query_args = array( | |
'post_type' => [ 'product_variation', 'product' ], | |
'posts_per_page' => - 1, | |
'meta_query' => array( | |
'relation' => 'AND', | |
array( | |
'key' => '_sale_price_dates_from', | |
'value' => time(), |
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
$(document).ajaxComplete(function (event, xhr, settings) { | |
//if (!settings.url.includes('update_listing_account')) { return; } | |
if (typeof settings.data != 'object') { return } | |
if (settings.data.get('action') != 'update_listing_account') { return } | |
if (typeof xhr.responseText != 'undefined') { | |
const response = $.parseJSON(xhr.responseText) | |
} | |
}); |
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 | |
/** | |
* Class XC_ProductCategories | |
* @usage $cat_list = new XC_ProductCategories(); | |
* @usage $cat_list->render($attributes); | |
*/ | |
class XC_ProductCategories { | |
public $defaults |
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
function geocode($address) | |
{ | |
// url encode the address | |
$address = urlencode($address); | |
$apiKey = GMAP_API_KEY; | |
// google map geocode api url | |
$url = "https://maps.googleapis.com/maps/api/geocode/json?address={$address}&key={$apiKey}"; | |
// get the json response | |
$resp_json = file_get_contents($url); | |
// decode the json |
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
//Delete all POSTS META | |
DELETE | |
FROM `wp_postmeta` | |
WHERE post_id in (SELECT id | |
FROM `wp_posts` | |
WHERE `post_type` = 'post' ) | |
//Delete all POSTS | |
DELETE FROM `wp_posts` | |
WHERE `post_type` = 'post' |
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 | |
/** | |
* Create the image attachment and return the new media upload id. | |
* | |
* @param $fileObject | |
* @return false|int|WP_Error | |
* @see http://codex.wordpress.org/Function_Reference/wp_insert_attachment#Example | |
* @since 1.0.0 | |
*/ |
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 | |
/** | |
* @title: WC Mini Cart | |
* @usage: echo do_shortcode( '[xcminicart]' ); | |
*/ | |
if ( ! class_exists( 'WooCommerce' ) ) { | |
return; | |
} |
NewerOlder