daily pastebin goal
44%
SHARE
TWEET

Untitled

a guest Sep 14th, 2018 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. // Call to action shortcode
  4.  
  5. function stock_cta_shortcode($atts, $content = null){
  6.  
  7.     extract( shortcode_atts( array(
  8.         'title' => '',  
  9.         'desc' => '',
  10.         'type' => 1,
  11.         'link_to_page' => '',
  12.         'theme' => 1,
  13.         'external_link' => '',
  14.         'link_text' => esc_html('Start a project','stock-toolkit'),
  15.     ), $atts) );
  16.  
  17.  
  18.     if($type == 1){
  19.         $link_source = get_page_link($link_to_page);
  20.     }else{
  21.         $link_source = $external_link;
  22.     }
  23.  
  24.     $stock_cta_desc_allowed_tags =
  25.     array(
  26.         'a' => array(
  27.             'href' => array(),
  28.             'title' => array()
  29.         ),
  30.         'img' => array(
  31.             'alt' => array(),
  32.             'title' => array()
  33.         ),
  34.         'br' => array(),
  35.         'em' => array(),
  36.         'strong' => array(),
  37.         'p' => array()
  38.     );
  39.  
  40.     $stock_cta_markup = '
  41.         <div class="stock-cta-box stock-cta-box-theme-'.esc_attr($theme).'">
  42.             <h2>'.esc_html($title).'</h2>
  43.             '.wp_kses(wpautop($desc), $stock_cta_desc_allowed_tags ).'
  44.             <a href="'.esc_url($link_source).'" class="bordered-btn">'.esc_html($link_text).'</a>
  45.         </div>
  46.     ';
  47.  
  48.     $stock_cta_markup .= '';
  49.  
  50.  
  51.     return $stock_cta_markup;
  52.  
  53.  
  54. }
  55. add_shortcode('stock_cta', 'stock_cta_shortcode' );
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top