'', ), $atts ); ob_start(); if (!empty($atts['product_id'])) { $post_id = $atts['product_id']; $image_url = get_post_meta($post_id, 'affiliate_image_url', true); $title = get_post_meta($post_id, 'affiliate_product_title', true); $amazon_url = get_post_meta($post_id, 'affiliate_amazon_url', true); $price = get_post_meta($post_id, 'affiliate_price', true); $show_prime_logo = get_post_meta($post_id, 'affiliate_show_prime_logo', true); $show_bestseller_label = get_post_meta($post_id, 'affiliate_show_bestseller_label', true); $market = get_post_meta($post_id, 'affiliate_amazon_market', true); $affiliate_id = get_option('affiliate_' . $market . '_id'); $affiliate_link = $amazon_url . '?tag=' . $affiliate_id; // Get the button text based on the selected Amazon region $button_text = get_option('affiliate_button_text_' . $market, 'Buy on Amazon'); echo '
'; if ($show_bestseller_label === 'yes') { echo '
' . esc_html__('BESTSELLER', 'affiliamaze-amazon-affiliate-linker') . '
'; // Text domain added here } echo '
'; echo '' . esc_attr($title) . ''; echo '
'; echo '

' . esc_html($title) . '

'; if ($show_prime_logo === 'yes') { echo '

' . esc_html($price) . '

'; // Text domain added here } else { echo '

' . esc_html($price) . '

'; } echo ''; // .mehrcontainer echo '
'; // .affiliate-info echo '
'; // .affiliate-book echo '
'; // .affiliate-frame } else { echo '

' . esc_html__('Please select an affiliate product.', 'affiliamaze-amazon-affiliate-linker') . '

'; // Text domain added here } return ob_get_clean(); } add_shortcode('AffiliAmaze', 'affiliate_linker_affiliamaze_affiliate_link_shortcode'); function affiliate_linker_affiliate_link_shortcode_styles() { wp_enqueue_style('affiliate-link-shortcode-style', plugin_dir_url(__FILE__) . 'affiliate-link-style.css'); } add_action('wp_enqueue_scripts', 'affiliate_linker_affiliate_link_shortcode_styles'); } ?>