This file contains hidden or 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
SELECT | |
p.ID as 'Order ID', | |
p.post_status as 'Order Status', | |
p.post_date as 'Order Date', | |
max( CASE WHEN pm.meta_key = '_billing_email' and p.ID = pm.post_id THEN pm.meta_value END ) as Email, | |
max( CASE WHEN pm.meta_key = '_billing_first_name' and p.ID = pm.post_id THEN pm.meta_value END ) as first_name, | |
max( CASE WHEN pm.meta_key = '_billing_last_name' and p.ID = pm.post_id THEN pm.meta_value END ) as last_name, | |
max( CASE WHEN pm.meta_key = '_billing_address_1' and p.ID = pm.post_id THEN pm.meta_value END ) as billing_address, | |
max( CASE WHEN pm.meta_key = '_shipping_address_1' and p.ID = pm.post_id THEN pm.meta_value END ) as shipping_address, | |
max( CASE WHEN pm.meta_key = '_order_total' and p.ID = pm.post_id THEN pm.meta_value END ) as order_total, |
This file contains hidden or 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 | |
/** | |
* Get My Location object | |
* Request to API endpoint https://geolocation-db.com | |
* @param REMOTE_ADDR | |
*/ | |
function get_user_location_by_ip () { | |
$response = file_get_contents('https://geolocation-db.com/json/'.$_SERVER['REMOTE_ADDR']); | |
$location = json_decode($response, true); | |
return $location; |
This file contains hidden or 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 | |
/** | |
* Return time to posted | |
*/ | |
function time_to_post($post = null) { | |
$current_day = date('Y-m-d h:i'); | |
$post_day = ( $post ) ? get_the_time('Y-m-d h:i', $post) : get_the_time('Y-m-d h:i'); | |
This file contains hidden or 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 Dropdown into Main Menu Login / Logout | |
*/ | |
add_filter( 'wp_nav_menu_items', 'fmc_items_login_logout', 10, 2); | |
function fmc_items_login_logout( $items, $args ) { | |
if ($args->theme_location == 'primary') { |
This file contains hidden or 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 | |
/* | |
* Hide all updates | |
*/ | |
function remove_core_updates(){ | |
global $wp_version; | |
return(object) array( | |
'last_checked'=> time(), | |
'version_checked'=> $wp_version |
This file contains hidden or 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 | |
abstract class Person { | |
protected $name; | |
protected $age; | |
public function __construct($name, $age) { | |
$this->name = $name; |
This file contains hidden or 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
$user_id = wp_get_current_user()->ID; | |
update_user_meta( $user_id, 'first_name', $_POST['user_firstname'] ); | |
update_user_meta( $user_id, 'last_name',$_POST['user_lastname'] ); | |
update_user_meta( $user_id, 'linkedin', $_POST['user_linkedin'] ); | |
update_user_meta( $user_id, 'facebook', $_POST['user_facebook'] ); | |
update_user_meta( $user_id, 'instagram', $_POST['user_instagram'] ); | |
update_user_meta( $user_id, 'twitter', $_POST['user_twitter'] ); | |
update_user_meta( $user_id, 'biography', $_POST['user_description'] ); | |
update_user_meta( $user_id, 'education', $_POST['user_education'] ); |
This file contains hidden or 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
/** | |
* Trim text, strip shortcodes and excerpt return | |
* | |
* @param Int $post - Post ID (optional) | |
* @param String $text - Text or get_the_conten() (optional) | |
* @param Int $words - Number of words to return | |
* | |
* @return string - "Ex: This is my text trim and..." | |
* | |
* Use: echo custom_trim_excerpt($post_id, '', 20 ); |