I hereby claim:
- I am alexminza on github.
- I am alexminza (https://keybase.io/alexminza) on keybase.
- I have a public key whose fingerprint is 4141 875C EAF5 42FF E633 4CB1 3EA4 3664 4C4F 5C80
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
//https://codex.wordpress.org/Function_Reference/shortcode_atts | |
$args = shortcode_atts( | |
array( | |
'option' => '', | |
'default' => '', | |
), $atts, 'get_option'); | |
//https://developer.wordpress.org/reference/functions/get_option/ | |
return get_option($args['option'], $args['default']); |
//https://stackoverflow.com/questions/30539549/woocommerce-product-link-url-for-simple-products | |
if(empty($atts)) { | |
return ''; | |
} | |
if(isset($atts['id'])) { | |
$product_data = get_post($atts['id']); | |
} elseif(isset($atts['sku'])) { | |
$product_id = wc_get_product_id_by_sku($atts['sku']); |
add_filter('woocommerce_get_country_locale', 'woocommerce_get_country_locale_romania'); | |
function woocommerce_get_country_locale_romania($countries) { | |
//https://github.com/woocommerce/woocommerce/blob/master/includes/class-wc-countries.php | |
$countries['RO']['state']['required'] = true; | |
} |
if(empty($atts)) { | |
return ''; | |
} | |
$slug = $atts['slug']; | |
$taxonomy = $atts['taxonomy']; | |
$term_link = get_term_link($slug, $taxonomy); | |
if(is_wp_error($term_link)) { |
<?php | |
//https://codex.wordpress.org/Plugin_API/Action_Reference/rss2_item | |
//https://validator.w3.org/feed/ | |
function add_rss_featured_image() { | |
global $post; | |
if(has_post_thumbnail($post->ID)) { | |
$thumbnail_id = get_post_thumbnail_id($post->ID); | |
$thumbnail = wp_get_attachment_image_src($thumbnail_id, 'large'); |
<?php | |
//https://github.com/woocommerce/woocommerce-google-analytics-integration/blob/master/includes/class-wc-google-analytics-js.php | |
function woocommerce_ga_snippet_output_userid($code) { | |
$user_id = get_current_user_id(); | |
if($user_id > 0) { | |
$ga_user_id = WC_Google_Analytics_JS::tracker_var() . "('set', 'userId', '" . $user_id . "');"; | |
$code = $code . $ga_user_id; | |
} | |
<?php | |
function set_locale($lang) { | |
define('LANG_PARAM', 'lang'); | |
$req_lang = $lang; | |
if(!isset($_SESSION)) | |
session_start(); | |
if(isset($_REQUEST[LANG_PARAM])) { |
<?php | |
function do_shortcode_title($title) { | |
return do_shortcode($title); | |
} | |
add_filter('the_title', 'do_shortcode_title'); | |
add_filter('single_post_title', 'do_shortcode_title'); |
<?php | |
//https://codex.wordpress.org/Function_Reference/shortcode_atts | |
$args = shortcode_atts( | |
array( | |
'text' => '', | |
'domain' => 'default', | |
), $atts, 'translate__'); | |
//https://developer.wordpress.org/reference/functions/__/ | |
return __($args['text'], $args['domain']); |