Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $inquire_button_alternative_text = get_post_meta($post->ID, "inquire_button_alternative_text", true);
- if (empty($inquire_button_alternative_text)) {
- //make a 'get a quote link'
- $nonce = wp_create_nonce($post->ID);
- // Store the current product information into temporarly for later use
- if (!isset($_SESSION['current_product']))
- {
- $_SESSION['current_product'] = array();
- }
- $_SESSION['current_product'][$nonce] = array(
- 'link' => get_permalink($post->ID),
- 'title' => get_the_title()
- );
- ?>
- <div class="left"><a href="<?php echo home_url().'?nonce='.$nonce; ?>">Get a quote</a></div>
- <?php } elseif(strpos($inquire_button_alternative_text, "shop.whiterabbitjapan")) {
- // make a buy now link
- define('REGEX_URL','/http\:\/\/[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(\/\S*)?/');
- define('REGEX_URLS','/https\:\/\/[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(\/\S*)?/');
- if(preg_match(REGEX_URL, $inquire_button_alternative_text, $url) || preg_match(REGEX_URLS, $inquire_button_alternative_text, $url)) {
- ?>
- <div class="left">
- <?php if (isset($_SESSION['partner']) && !empty($_SESSION['partner'])) {
- $url[0] = add_query_arg( 'a_aid', $_SESSION['partner'],$url[0]);
- }?>
- <a href="<?php echo $url[0]; ?>" target="_blank">Buy from our shop</a>
- </div>
- <?php }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement