All the working coupon manager plugins in WordPress are paid. So, I thought of creating a new one. I wanted to create a coupon box like one this site has: http://www.bestbigrockcoupons.com/
So far I’ve managed to create a Shortcode on WordPress to generate the coupon box.
Here’s the code:
function couponbox_func($atts) {
extract(shortcode_atts(array(
'coupon' => '',
'url' => '',
'expires' => '',
), $atts));
if($expires)
{
$expires = "<span class="expires">Expires: " . $expires . "</span><br>";
}
if($name && $url)
{
return "<div class="cbox">
" . $expires . "
<a class="myButton" href=""
. $url . "
" target="_blank">" . $coupon . "</a>
</div>";
}
}
add_shortcode( 'couponbox', 'couponbox_func' );
Now my question is that what should I do so that when a user clicks on the box, the coupon ($coupon) gets copied in user’s clipboard similar to what happens in the above mentioned site.
Thanks.