⚡ NEW: Changeset/ - High Quality

Changeset 885568


Ignore:
Timestamp:
04/01/2014 11:29:09 AM (12 years ago)
Author:
aniketpant
Message:

Add shortcode

File:
1 edited

Legend:

Unmodified
Added
Removed
  • instamojo/trunk/shortcode.php

    r883557 r885568  
    55 */
    66
     7add_shortcode('instamojo', 'instamojo_button');
     8
     9function instamojo_button($attributes, $content = null)
     10{
     11  extract(shortcode_atts(array(
     12    'offer' => null,
     13    'style' => 'none',
     14    'text'  => 'Checkout with Instamojo'
     15  ), $attributes));
     16
     17  $instamojo_credentials = get_option('instamojo_credentials');
     18
     19  wp_register_script('widgetjs', 'https://d2xwmjc4uy2hr5.cloudfront.net/im-embed/im-embed.min.js', 'jquery', null, true);
     20  wp_enqueue_script('widgetjs');
     21
     22  if ($offer)
     23  {
     24    return '<a href="https://www.instamojo.com/'.$instamojo_credentials['username'].'/'.$offer.'/" rel="im-checkout" data-style="'.$style.'" data-text="'.$text.'"></a>';
     25  }
     26}
     27
    728?>
Note: See TracChangeset for help on using the changeset viewer.