null, 'asin' => null, 'variations' => true, 'image_width' => null, 'image_height' => null, ), $atts); $atts['postId'] = $atts['ID']; $atts['variations'] = kbAmzShortCodeBool($atts['variations']); if (!$atts['postId'] && !$atts['asin']) { return new KbAmzErrorString('[kb_amz_product] - ID or asin parameter is required.'); } return getKbAmzAdminController()->shortCodeProductAction($atts); } add_shortcode('kb_amz_product', 'kb_amz_product_func'); // [kb_amz_product_attributes] function kb_amz_product_attributes_func($atts) { $atts = shortcode_atts( array( 'postId' => get_the_ID() ), $atts); $shortCodes = getKbAmz()->getShortCodes(); if (isset($shortCodes['attributes']['active']) && !$shortCodes['attributes']['active']) { return; } $html = << %s HTML; $htmlList = << %s : %s HTML; $meta = getKbAmz()->getProductMeta($atts['postId']); $attributes = getKbAmz()->getShortCodeAttributes(); $markup = ''; foreach ($attributes as $attr => $label) { if (isset($meta[$attr]) && !empty($meta[$attr])) { $markup .= sprintf( $htmlList, strtolower(str_replace('.', '-', $attr)), $label, ($attr == KbAmazonStore::PRICE_ATTRIBUTE ? ' kb-amz-item-price' : ''), $meta[$attr] ); } } if (empty($markup)) { return; } return sprintf( $html, $markup ); } add_shortcode( 'kb_amz_product_attributes', 'kb_amz_product_attributes_func' ); function getKbProductGalleryContent($atts) { $html = << %s %s HTML; $images = getKbAmz()->getProductImages(get_the_ID()); if (count ($images) > 1) { $imagesHtml = $images->getImagesHtml($atts['size']); } else { $imagesHtml = $images->getImagesHtmlSkipFirst($atts['size']); } $thumb = $images->getFirst($atts['size']); if (empty($thumb)) { return; } return sprintf( $html, empty($images) ? 'has-no-thumbs' : 'has-thumbs', (isset($atts['class']) ? $atts['class'] : ''), $thumb ? '