rejuancse

coming-soon

Dec 20th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.15 KB | None | 0 0
  1. <?php
  2. if ( ! defined( 'ABSPATH' ) ) {
  3.     exit; # Exit if accessed directly
  4. }
  5.  
  6. # String event CountDown
  7. add_shortcode( 'themeum_countdown_counter', function($atts, $content = null){
  8.  
  9.     extract(
  10.         shortcode_atts(
  11.             array(
  12.                 'position'              => 'left',
  13.                 'date'                  => '',
  14.                 "title"                 => '',
  15.                 "title_fontsize"        => '',
  16.                 "class"                 =>'',
  17.             ),
  18.         $atts
  19.     ));
  20.  
  21.     global $post;
  22.    
  23.     $output = $align = '';
  24.     if($position) $align .= 'text-align:'. esc_attr( $position ) .';';
  25.  
  26.     $output .= '<div class="wpb_wrapper">';
  27.     $output .= '<div class="shortcode-event-countdown string-countdown-wrap-cont '.esc_attr($class).'" style="'. $align .'">';
  28.         $countdate = str_replace('-', '-', $date);
  29.  
  30.         $output .= '<div class="counter-class" data-date="'.$countdate.'">';
  31.             $output .= '<div id="comingsoon-countdown">';
  32.                 $output .= '<div class="countdown-section"><span class="countdown-amount first-item countdown-days counter-days"></span> <span class="countdown-period">'.esc_html__( 'Days', 'themeum-core' ).'</span></div>';
  33.                 $output .= '<div class="countdown-section"><span class="countdown-amount countdown-hours counter-hours"></span> <span class="countdown-period">'.esc_html__( 'Hours', 'themeum-core' ).'</span></div>';
  34.                 $output .= '<div class="countdown-section"><span class="countdown-amount countdown-minutes counter-minutes"></span> <span class="countdown-period">'.esc_html__( 'Minutes', 'themeum-core' ).'</span></div>';
  35.                 $output .= '<div class="countdown-section"><span class="countdown-amount countdown-seconds counter-seconds"></span> <span class="countdown-period">'.esc_html__( 'Seconds', 'themeum-core' ).'</span></div>';
  36.             $output .= '</div>';
  37.         $output .= '</div>';
  38.  
  39.     $output .= '</div>';
  40.     $output .= '</div>';
  41.  
  42.     return $output;
  43. });
  44.  
  45.  
  46.  
  47. # Visual Composer
  48. if (class_exists('WPBakeryVisualComposerAbstract')) {
  49. vc_map(array(
  50.     "name"          => esc_html__("Strings Events Counter", 'themeum-core'),
  51.     "base"          => "themeum_countdown_counter",
  52.     "icon"          => "icon-thm-event-counter",
  53.     "class"         => "",
  54.     "description"   => esc_html__("Strings Events Counter addons", 'themeum-core'),
  55.     "category"      => __('Strings', 'themeum-core'),
  56.     "params"        => array(
  57.  
  58.             array(
  59.                 "type"          => "dropdown",
  60.                 "heading"       => esc_html__("Position", 'themeum-core'),
  61.                 "param_name"    => "position",
  62.                 "value"         => array('Select'=>'','Left'=>'left','Center'=>'center','Right'=>'right'),
  63.             ), 
  64.             array(
  65.                 "type"          => "textfield",
  66.                 "heading"       => esc_html__("Countdown Date", 'themeum-core'),
  67.                 "param_name"    => "date",
  68.                 "value"         => "2020-10-10 12:34:56",
  69.                 "description"   => __("Date and time format (yyyy-mm-dd hh:mm:ss) Ex. 2020-10-10 12:34:56", 'themeum-core'),
  70.             ),
  71.             array(
  72.                 "type"          => "textfield",
  73.                 "heading"       => esc_html__("Font Size", 'themeum-core'),
  74.                 "param_name"    => "title_fontsize",
  75.                 "value"         => "",
  76.             ),
  77.             array(
  78.                 "type"          => "textfield",
  79.                 "heading"       => esc_html__("Extra CSS Class", 'themeum-core'),
  80.                 "param_name"    => "class",
  81.                 "value"         => "",
  82.                 "description"   => "If you wish to style particular content element differently."
  83.             ),
  84.             # Array end process.
  85.         )
  86.     ));
  87. }
Add Comment
Please, Sign In to add comment