Advertisement
Guest User

shortcodes

a guest
Oct 25th, 2014
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 41.74 KB | None | 0 0
  1. <?php
  2. /* ---------------------------------------------------------------------- */
  3. /*  Columns
  4. /* ---------------------------------------------------------------------- */
  5.     function framework_one_col_sc( $atts, $content = null ) {
  6.  
  7.         return '<div class="col-md-12">' . do_shortcode( $content ) . '</div><div class="clearfix"></div>';
  8.  
  9.     }
  10.     add_shortcode('one_col', 'framework_one_col_sc');
  11.  
  12.     /* -------------------------------------------------- */
  13.     /*  One half
  14.     /* -------------------------------------------------- */
  15.  
  16.     function framework_one_half_sc( $atts, $content = null ) {
  17.  
  18.         return '<div class="col-md-6">' . do_shortcode( $content ) . '</div>';
  19.  
  20.     }
  21.     add_shortcode('one_half', 'framework_one_half_sc');
  22.  
  23.     function framework_one_twelve_sc( $atts, $content = null ) {
  24.  
  25.         return '<div class="col-md-2">' . do_shortcode( $content ) . '</div>';
  26.  
  27.     }
  28.     add_shortcode('one_twelve', 'framework_one_twelve_sc');
  29.  
  30.     function framework_one_twelve_last_sc( $atts, $content = null ) {
  31.  
  32.         return '<div class="col-md-2">' . do_shortcode( $content ) . '</div><div class="clearfix"></div>';
  33.  
  34.     }
  35.     add_shortcode('one_twelve_last', 'framework_one_twelve_last_sc');
  36.  
  37.  
  38.     /* -------------------------------------------------- */
  39.     /*  One half last
  40.     /* -------------------------------------------------- */
  41.  
  42.     function framework_one_half_last_sc( $atts, $content = null ) {
  43.  
  44.         return '<div class="col-md-6">' . do_shortcode( $content ) . '</div><div class="clearfix"></div>';
  45.  
  46.     }
  47.     add_shortcode('one_half_last', 'framework_one_half_last_sc');
  48.  
  49.     /* -------------------------------------------------- */
  50.     /*  One third
  51.     /* -------------------------------------------------- */
  52.  
  53.     function framework_one_third_sc( $atts, $content = null ) {
  54.  
  55.         return '<div class="col-md-4">' . do_shortcode( $content ) . '</div>';
  56.  
  57.     }
  58.     add_shortcode('one_third', 'framework_one_third_sc');
  59.  
  60.     /* -------------------------------------------------- */
  61.     /*  One third last
  62.     /* -------------------------------------------------- */
  63.  
  64.     function framework_one_third_last_sc( $atts, $content = null ) {
  65.  
  66.         return '<div class="col-md-4">' . do_shortcode( $content ) . '</div><div class="clearfix"></div>';
  67.  
  68.     }
  69.     add_shortcode('one_third_last', 'framework_one_third_last_sc');
  70.  
  71.     /* -------------------------------------------------- */
  72.     /*  One fourth
  73.     /* -------------------------------------------------- */
  74.  
  75.     function framework_one_fourth_sc( $atts, $content = null ) {
  76.  
  77.         return '<div class="col-md-3">' . do_shortcode( $content ) . '</div>';
  78.  
  79.     }
  80.     add_shortcode('one_fourth', 'framework_one_fourth_sc');
  81.  
  82.     /* -------------------------------------------------- */
  83.     /*  One fourth last
  84.     /* -------------------------------------------------- */
  85.  
  86.     function framework_one_fourth_last_sc( $atts, $content = null ) {
  87.  
  88.         return '<div class="col-md-3">' . do_shortcode( $content ) . '</div><div class="clearfix"></div>';
  89.  
  90.     }
  91.     add_shortcode('one_fourth_last', 'framework_one_fourth_last_sc');
  92.  
  93.     /* -------------------------------------------------- */
  94.     /*  Two third
  95.     /* -------------------------------------------------- */
  96.  
  97.     function framework_two_third_sc( $atts, $content = null ) {
  98.  
  99.         return '<div class="col-md-8">' . do_shortcode( $content ) . '</div>';
  100.  
  101.     }
  102.     add_shortcode('two_third', 'framework_two_third_sc');
  103.  
  104.     /* -------------------------------------------------- */
  105.     /*  Two third last
  106.     /* -------------------------------------------------- */
  107.  
  108.     function framework_two_third_last_sc( $atts, $content = null ) {
  109.  
  110.         return '<div class="col-md-4">' . do_shortcode( $content ) . '</div><div class="clearfix"></div>';
  111.  
  112.     }
  113.     add_shortcode('two_third_last', 'framework_two_third_last_sc');
  114.  
  115.     /* -------------------------------------------------- */
  116.     /*  Three fourth
  117.     /* -------------------------------------------------- */
  118.  
  119.     function framework_three_four_sc( $atts, $content = null ) {
  120.  
  121.         return '<div class="col-md-9">' . do_shortcode( $content ) . '</div>';
  122.  
  123.     }
  124.     add_shortcode('three_fourth', 'framework_three_four_sc');
  125.  
  126.     /* -------------------------------------------------- */
  127.     /*  Three fourth last
  128.     /* -------------------------------------------------- */
  129.  
  130.     function framework_three_fourth_last_sc( $atts, $content = null ) {
  131.  
  132.         return '<div class="col-md-3">' . do_shortcode( $content ) . '</div><div class="clearfix"></div>';
  133.  
  134.     }
  135.     add_shortcode('three_fourth_last', 'framework_three_fourth_last_sc');
  136.  
  137.  
  138.  
  139. /* ---------------------------------------------------------------------- */
  140. /*  Alert Boxes
  141. /* ---------------------------------------------------------------------- */
  142.  
  143.     /* -------------------------------------------------- */
  144.     /*  Error
  145.     /* -------------------------------------------------- */
  146.  
  147.     function framework_error_sc( $atts, $content = null ) {
  148.  
  149.         return '<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' . $content . '</div>';
  150.  
  151.     }
  152.     add_shortcode('error', 'framework_error_sc');
  153.  
  154.     /* -------------------------------------------------- */
  155.     /*  Success
  156.     /* -------------------------------------------------- */
  157.  
  158.     function framework_success_sc( $atts, $content = null ) {
  159.  
  160.         return '<div class="alert alert-success alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' . $content . '</div>';
  161.  
  162.     }
  163.     add_shortcode('success', 'framework_success_sc');
  164.  
  165.     /* -------------------------------------------------- */
  166.     /*  Info
  167.     /* -------------------------------------------------- */
  168.  
  169.     function framework_info_sc( $atts, $content = null ) {
  170.  
  171.         return '<div class="alert alert-info alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' . $content . '</div>';
  172.  
  173.     }
  174.     add_shortcode('info', 'framework_info_sc');
  175.  
  176.     /* -------------------------------------------------- */
  177.     /*  Notice
  178.     /* -------------------------------------------------- */
  179.  
  180.     function framework_notice_sc( $atts, $content = null ) {
  181.  
  182.         return '<div class="alert alert-warning alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' . $content . '</div>';
  183.  
  184.     }
  185.     add_shortcode('notice', 'framework_notice_sc');
  186.  
  187. /* ---------------------------------------------------------------------- */
  188. /*  General
  189. /* ---------------------------------------------------------------------- */
  190.    
  191.     /* -------------------------------------------------- */
  192.     /*  Ads
  193.     /* -------------------------------------------------- */
  194.  
  195.     function framework_ads_sc( $atts, $content = null ) {
  196.  
  197.         extract( shortcode_atts( array(
  198.             'url' => '',
  199.             'bannerurl' => '',
  200.         ), $atts ) );
  201.  
  202.         return '<div class="ads group clearfix"><a href="'.esc_attr($url).'" /><img src="'.esc_attr( $bannerurl ).'"></a></div>';
  203.    
  204.     }
  205.     add_shortcode('ads', 'framework_ads_sc');
  206.  
  207.     /* -------------------------------------------------- */
  208.     /*  Divider
  209.     /* -------------------------------------------------- */
  210.  
  211.     function framework_divider_sc( $atts, $content = null ) {
  212.  
  213.         extract( shortcode_atts( array(
  214.             'style' => ''
  215.         ), $atts ) );
  216.  
  217.         return '<hr class="' . esc_attr( $style ) . '" />';
  218.    
  219.     }
  220.     add_shortcode('divider', 'framework_divider_sc');
  221.  
  222.     /* -------------------------------------------------- */
  223.     /*  Button
  224.     /* -------------------------------------------------- */
  225.  
  226.     function framework_button_sc( $atts, $content = null ) {
  227.  
  228.         extract( shortcode_atts( array(
  229.             'url'   => '',
  230.             'size'  => '',
  231.             'style' => ''
  232.         ), $atts ) );
  233.  
  234.         $output = '<a class="btn ' . esc_attr( $size ) . ' ' . esc_attr( $style ) . '" href="' . esc_attr( $url ) . '">';
  235.  
  236.         $output .= $content;
  237.  
  238.         $output .= '</a>';
  239.  
  240.         return $output;
  241.    
  242.     }
  243.     add_shortcode('button', 'framework_button_sc');
  244.  
  245.     /* -------------------------------------------------- */
  246.     /*  List
  247.     /* -------------------------------------------------- */
  248.  
  249.     function framework_list_sc( $atts, $content = null ) {
  250.  
  251.         extract( shortcode_atts( array(
  252.             'icon'  => '',
  253.             'style' => ''
  254.         ), $atts ) );
  255.  
  256.         return '<div class="custom-list ' . esc_attr( $icon ) . ' ' . esc_attr( $style ) . '">' . $content . '</div>';
  257.  
  258.     }
  259.     add_shortcode('list', 'framework_list_sc');
  260.  
  261.  
  262.     /* -------------------------------------------------- */
  263.     /*  Quote
  264.     /* -------------------------------------------------- */
  265.  
  266.     function framework_quote_sc( $atts, $content = null ) {
  267.  
  268.         extract( shortcode_atts( array(
  269.             'author' => '',
  270.             'type'   => ''
  271.         ), $atts ) );
  272.  
  273.         $output = '<blockquote class="' . esc_attr( $type ) . '">';
  274.  
  275.         $output .= '<p>' . $content . '</p>';
  276.  
  277.         if( $author )
  278.             $output .= '<small>' . esc_attr( $author ) . '</small>';
  279.  
  280.         $output .= '</blockquote>';
  281.  
  282.         return $output;
  283.  
  284.     }
  285.     add_shortcode('quote', 'framework_quote_sc');
  286.  
  287.  
  288.     /* -------------------------------------------------- */
  289.     /*  Accordion Content
  290.     /* -------------------------------------------------- */
  291.  
  292.     function framework_accordion_content_sc( $atts, $content = null ) {
  293.  
  294.         extract( shortcode_atts( array(
  295.             'title'      => '',
  296.             'title_size' => 'span'
  297.         ), $atts ) );
  298.  
  299.         return '<div class="acc"><' . esc_attr( $title_size ) . ' class="acc-trigger"><a href="#">' . esc_attr( $title ) . '</a></' . esc_attr( $title_size ) . '><div class="acc-container"><div class="content">' . do_shortcode( $content ) . '</div></div></div>';
  300.    
  301.     }
  302.     add_shortcode('accordion_content', 'framework_accordion_content_sc');
  303.  
  304.     /* -------------------------------------------------- */
  305.     /*  Latest Post
  306.     /* -------------------------------------------------- */
  307.  
  308.     function framework_latest_post_sc( $atts ) {
  309.  
  310.         extract( shortcode_atts( array(
  311.             'style'     => '',
  312.             'category'  => '',
  313.             'color'     => '',
  314.             'limit'     => '',
  315.             'thumbnail' => '',
  316.             'muslimah'  =>false
  317.         ), $atts ) );
  318.  
  319.         $query = new WP_Query(array('category_name' => $category, "posts_per_page"=>$limit));
  320.         $count =1;
  321.         $category_id = get_cat_ID( str_replace("-", " ", $category) );
  322.         $category_link = get_category_link( $category_id );
  323.         $category_feed_link = get_category_feed_link( $category_id,"rss2");
  324.  
  325.         switch ($style) {
  326.             case 'style1':
  327.                 $output   = "<div class='".$style." group ".$color." '>";
  328.                 $output  .= "<div class='group-title'>";
  329.                 $output  .= "   <h2><i class='fa fa-folder-open'></i><a href=$category_link>".str_replace("-", " ", $category)."</a></h2>";
  330.                 $output  .= "   <div  class='feed' ><a href=$category_feed_link data-toggle='tooltip' data-placement='left' title='Belangganan kategori ini'><i class='fa fa-rss'></i></a></div>";
  331.                 $output  .= "</div>";
  332.                 $output  .= "<div class='group-content'>";
  333.                 $output  .=     "<ul class='style1 articles'>";
  334.  
  335.                 while ($query->have_posts()) : $query->the_post();
  336.                     $output .= "<li>";
  337.                     if($thumbnail=="yes"){
  338.                     $output .=      "<figure class='thumbnail'>";
  339.  
  340.                     $postimage = post_image();
  341.                     if(!empty($postimage)):
  342.                         $output .=  "<img src='".resize_image(post_image(),70,70)."' alt='".esc_html(get_the_title())."' width=70 height=70>";
  343.                     else:
  344.                         $output .=  "<img src='".get_template_directory_uri()."/images/placeholder-70.jpg' alt='".esc_html(get_the_title())."' width=70 height=70>";
  345.                     endif;
  346.  
  347.                     $output .=      "</figure>";
  348.                     }
  349.                     $output .=      "<div class='meta ".(($thumbnail=="yes")?"has-thumb":"")."'>";
  350.                     $output .=          "<h3><a href='".get_permalink()."' title='".esc_html(get_the_title())."'>".esc_html(get_the_title())."</a></h3>";
  351.                     $output .=          "<div>";
  352.                     $output .=              "<span class='time'><i class='fa fa-calendar'></i>".get_the_date('j M Y')."</span>";
  353.                     $output .=              "<span class='author'><i class='fa fa-user'></i>".get_the_author()."";
  354.                     $output .=          "</div>";
  355.                     if($style=="style2" && $count==1){
  356.                     $output .=          "<p>".get_the_excerpt()."</p>";
  357.                     }
  358.                     $output .=      "</div>";
  359.                     $output .=  "</li>";
  360.  
  361.                     $count++;
  362.                 endwhile;
  363.  
  364.                 $output .= "</ul></div></div>";
  365.  
  366.                 break;
  367.  
  368.             case 'style2':
  369.                 $styleg="style2 group-content";
  370.  
  371.                 $output   = "<div class='style2 group ".$color." '>";
  372.                 $output  .= "<div class='group-title'>";
  373.                 $output  .= "   <h2><i class='fa fa-folder-open'></i><a href=$category_link>".str_replace("-", " ", $category)."</a></h2>";
  374.                 $output  .= "   <div  class='feed' ><a href=$category_feed_link data-toggle='tooltip' data-placement='left' title='Belangganan kategori ini'><i class='fa fa-rss'></i></a></div>";
  375.                 $output  .= "</div>";
  376.                 $output  .= "<div class='group-content'>";
  377.                 $output  .=     "<ul class='style2 group-content articles'>";
  378.  
  379.                 while ($query->have_posts()) : $query->the_post();
  380.                     if($count==1){
  381.                         $output .= "<li class='first'>";
  382.                     }else{
  383.                         $output .= "<li>";
  384.                     }
  385.                     if($thumbnail=="yes"){
  386.                         $output .=      "<figure class='thumbnail'>";
  387.  
  388.                         $postimage = post_image();
  389.                         if(!empty($postimage)):
  390.                             $thumb = ($count==1)?resize_image(post_image(),310,200):resize_image(post_image(),70,70);
  391.                             $output .=  "<img src='".$thumb."' alt='".esc_html(get_the_title())."'".(($count==1)?"width=310 height=200":"width=70 height=70").">";
  392.                         else:
  393.                             $output .=  "<img src='".get_template_directory_uri()."/images/".(($count==1)?"placeholder-310.jpg":"placeholder-70.jpg")."' alt='".esc_html(get_the_title())."'>";
  394.                         endif;
  395.  
  396.                         $output .=      "</figure>";
  397.                     }
  398.                     $output .=      "<div class='meta'>";
  399.                     $output .=          "<h3><a href='".get_permalink()."' title='".esc_html(get_the_title())."'>".esc_html(get_the_title())."</a></h3>";
  400.                     $output .=          "<div>";
  401.                     $output .=              "<span class='time'><i class='fa fa-calendar'></i>".get_the_date('j M Y')."</span>";
  402.                     $output .=              "<span class='author'><i class='fa fa-user'></i>".get_the_author()."";
  403.                     $output .=          "</div>";
  404.                     if($count==1){
  405.                         $output .=  "<p>".get_the_excerpt()."</p>";
  406.                     }
  407.                     $output .=      "</div>";
  408.                     $output .=  "</li>";
  409.  
  410.                     $count++;
  411.                 endwhile;
  412.  
  413.                 $output .= "</ul></div></div>";
  414.                 break;
  415.  
  416.             case 'style3':
  417.                 $qry[1] = 1;
  418.                 $qry[2] = $limit-1;
  419.                 $qry['total'] = array_sum($qry);
  420.  
  421.                 $paged = (get_query_var('page')) ? get_query_var('page') : 1;
  422.                 $onum = ($qry['total'] * ($paged - 1));
  423.                 $type = "post";
  424.  
  425.                 $output   = "<div class='style3 group ".$color." ".(($muslimah)?"muslimah":"")."'>";
  426.                 $output  .= "<div class='group-title'>";
  427.                 $output  .= "   <h2><i class='fa fa-folder-open'></i><a href=".(($muslimah)?"http://www.hasmi.org/halaman-pernik-muslimah/":$category_link).">".str_replace("-", " ", $category)."</a></h2>";
  428.                 $output  .= "   <div  class='feed' ><a href=$category_feed_link data-toggle='tooltip' data-placement='left' title='Belangganan kategori ini'><i class='fa fa-rss'></i></a></div>";
  429.                 $output  .= "</div>";
  430.                 $output  .= "<div class='group-content'>";
  431.                 $output  .= "<div class='row'>";
  432.  
  433.                 $offset = ($paged > 1) ? ($onum) : 0;
  434.                 query_posts("post_type=$type&category_name=$category&posts_per_page=$qry[total]&paged=$paged&showposts=$qry[1]&offset=$offset");
  435.                
  436.                 $output  .= "<div class='col-md-6'>";
  437.                 $output  .=     "<ul class='style2 articles'>";
  438.                
  439.                 if (have_posts()) : while (have_posts()) : the_post();
  440.                    
  441.                     $output .= "<li class='first'>";
  442.                     $output .=      "<figure class='thumbnail'>";
  443.                     $postimage = post_image();
  444.                     if(!empty($postimage)):
  445.                         $output .=  "<img src='".resize_image(post_image(),280,200)."' alt='".esc_html(get_the_title())."' width=280 height=200>";
  446.                     else:
  447.                         $output .=  "<img src='".get_template_directory_uri()."/images/placeholder-70.jpg' alt='".esc_html(get_the_title())."'>";
  448.                     endif;
  449.                     $output .=      "</figure>";
  450.  
  451.                     $output .=      "<div class='meta'>";
  452.                     $output .=          "<h3><a href='".get_permalink()."' title='".esc_html(get_the_title())."'>".string_limit_words(esc_html(get_the_title()),8)."</a></h3>";
  453.                     $output .=          "<div>";
  454.                     $output .=              "<span class='time'><i class='fa fa-calendar'></i>".get_the_date('j M Y')."</span>";
  455.                     $output .=              "<span class='author'><i class='fa fa-user'></i>".get_the_author()."";
  456.                     $output .=          "</div>";
  457.                     $output .=          "<p>".get_the_excerpt()."</p>";
  458.                     $output .=      "</div>";
  459.                     $output .=  "</li>";
  460.  
  461.                 endwhile;endif;
  462.                 $output .= "</ul></div>";
  463.  
  464.                 $offset = $qry[1] + (($paged > 1) ? $onum : 0);
  465.                 query_posts("post_type=$type&category_name=$category&posts_per_page=$qry[total]&offset=$offset&showposts=$qry[2]");
  466.                 $output  .= "<div class='col-md-6'>";
  467.                 $output  .=     "<ul class='style1 articles'>";
  468.                 if (have_posts()) : while (have_posts()) : the_post();
  469.                    
  470.                     $output .= "<li>";
  471.                     $output .=      "<figure class='thumbnail'>";
  472.                     $postimage = post_image();
  473.                     if(!empty($postimage)):
  474.                         $output .=  "<img src='".resize_image(post_image(),70,70)."' alt='".esc_html(get_the_title())."' width=70 height=70>";
  475.                     else:
  476.                         $output .=  "<img src='".get_template_directory_uri()."/images/placeholder-70.jpg' alt='".esc_html(get_the_title())."' width=70 height=70>";
  477.                     endif;
  478.                     $output .=      "</figure>";
  479.  
  480.                     $output .=      "<div class='meta'>";
  481.                     $output .=          "<h3><a href='".get_permalink()."' title='".esc_html(get_the_title())."'>".string_limit_words(esc_html(get_the_title()),8)."</a></h3>";
  482.                     $output .=          "<div>";
  483.                     $output .=              "<span class='time'><i class='fa fa-calendar'></i>".get_the_date('j M Y')."</span>";
  484.                     $output .=              "<span class='author'><i class='fa fa-user'></i>".get_the_author()."";
  485.                     $output .=          "</div>";
  486.                     $output .=      "</div>";
  487.                     $output .=  "</li>";
  488.                 endwhile;
  489.                 endif;
  490.                 $output .= "</ul></div></div></div></div>";
  491.  
  492.                 break;
  493.             case 'style4':
  494.                 $style = "style4";
  495.                 $styleg = "style1";
  496.  
  497.                 $output   = "<div class='style4 group ".$color." '>";
  498.                 $output  .= "<div class='group-title'>";
  499.                 $output  .= "   <h2><i class='fa fa-folder-open'></i><a href=$category_link>".str_replace("-", " ", $category)."</a></h2>";
  500.                 $output  .= "   <div  class='feed' ><a href=$category_feed_link data-toggle='tooltip' data-placement='left' title='Belangganan kategori ini'><i class='fa fa-rss'></i></a></div>";
  501.                 $output  .= "</div>";
  502.                 $output  .= "<div class='group-content'>";
  503.                 $output  .=     "<ul class='style1 articles'>";
  504.  
  505.                 while ($query->have_posts()) : $query->the_post();
  506.                     $output .= "<li>";
  507.                     if($thumbnail=="yes"){
  508.                         $output .=      "<figure class='thumbnail'>";
  509.  
  510.                         $postimage = post_image();
  511.                         if(!empty($postimage)):
  512.                             $output .=  "<img src='".resize_image(post_image(),70,70)."' alt='".esc_html(get_the_title())."'>";
  513.                         else:
  514.                             $output .=  "<img src='".get_template_directory_uri()."/images/placeholder-70.jpg' alt='".esc_html(get_the_title())."'>";
  515.                         endif;
  516.  
  517.                         $output .=      "</figure>";
  518.                     }
  519.                     $output .=      "<div class='meta'>";
  520.                     $output .=          "<h3><a href='".get_permalink()."' title='".esc_html(get_the_title())."'>".esc_html(get_the_title())."</a></h3>";
  521.                     $output .=          "<div>";
  522.                     $output .=              "<span class='time'><i class='fa fa-calendar'></i>".get_the_date('j M Y')."</span>";
  523.                     $output .=              "<span class='author'><i class='fa fa-user'></i>".get_the_author()."";
  524.                     $output .=          "</div>";
  525.                     $output .=      "</div>";
  526.                     $output .=  "</li>";
  527.  
  528.                 endwhile;
  529.  
  530.                 $output .= "</ul></div></div>";
  531.                 break;
  532.             case "style5":
  533.                 $output   = "<div class='".$style." group ".$color." '>";
  534.                 $output  .= "<div class='group-title'>";
  535.                 $output  .= "   <h2><i class='fa fa-folder-open'></i><a href=$category_link>".str_replace("-", " ", $category)."</a></h2>";
  536.                 $output  .= "   <div  class='feed' ><a href=$category_feed_link data-toggle='tooltip' data-placement='left' title='Belangganan kategori ini'><i class='fa fa-rss'></i></a></div>";
  537.                 $output  .= "</div>";
  538.                 $output  .= "<div class='group-content'>";
  539.                 $output  .=     "<ul class='style1 articles'>";
  540.  
  541.                 while ($query->have_posts()) : $query->the_post();
  542.                     $output .= "<li>";
  543.                     $output .=      "<div class='calendar'>";
  544.                     //$output .=            "<div class='day'>".localize_day(get_the_date("j"))."</div>";
  545.                     $isotime = get_post_meta(get_the_ID(),"tanggal",true)."-".get_post_meta(get_the_ID(),"bulan",true)."-".get_post_meta(get_the_ID(),"tahun",true);
  546.                     $bln = array(1=>"Jan","Feb","Mar","Apr","Mei","Jun","Jul","Ags","Sep","Okt","Nov","Des");
  547.                     $blnn= get_post_meta(get_the_ID(),"bulan",true);
  548.                     $output .=          "<div class='day'>".localize_day(strtotime($isotime))."</div>";
  549.                     $output .=          "<div class='tgl'>".get_post_meta(get_the_ID(),"tanggal",true)."</div>";
  550.                     $output .=          "<div class='bln'>".$bln[$blnn]."</div>";
  551.                     $output .=      "</div>";
  552.                     $output .=      "<div class='meta has-thumb'>";
  553.                     $output .=          "<h3><a href='".get_permalink()."' title='".esc_html(get_the_title())."'>".esc_html(get_the_title())."</a></h3>";
  554.                     $output .=          "<div>";
  555.                     $output .=          "</div>";
  556.                     if($style=="style2" && $count==1){
  557.                     $output .=          "<p>".get_the_excerpt()."</p>";
  558.                     }
  559.                     $output .=      "</div>";
  560.                     $output .=  "</li>";
  561.  
  562.                     $count++;
  563.                 endwhile;
  564.  
  565.                 $output .= "</ul></div></div>";
  566.                 break;
  567.  
  568.             case "style6":
  569.                 $output ="<div class='group $style $color '>";
  570.                 $output .=  "<div class='group-title'>";
  571.                 $output .=      "<h2><i class='fa fa-folder-open'></i><a href=$category_link>".str_replace("-", " ", $category)."</a></h2>";
  572.                 $output .=      "<div class='feed'>";
  573.                 $output .=          "<a href=$category_feed_link data-toggle='tooltip' data-placement='left' title='' data-original-title='Belangganan kategori ini'><i class='fa fa-rss'></i></a>";
  574.                 $output .=      "</div>";
  575.                 $output .=  "</div>";
  576.                 $output .=  "<ul>";
  577.                 while ($query->have_posts()) : $query->the_post();
  578.                 $output .=      "<li>";
  579.                 $output .=              "<figure class='post-thumbnail'>";
  580.                 $postimage = post_image();
  581.                 if(!empty($postimage)):
  582.                     $output .=  "<img src='".resize_image(post_image(),233,150)."' alt='".esc_html(get_the_title())."' width=233 height=150>";
  583.                 else:
  584.                     $output .=  "<img src='".get_template_directory_uri()."/images/placeholder-310.jpg' alt='".esc_html(get_the_title())."' width=233 height=150>";
  585.                 endif;
  586.                 $output .=          "</figure>";
  587.                 $output .=          "<h3><a href='".get_permalink()."'>".esc_html(get_the_title())."</a></h3>";
  588.                 $output .=          "<div>";
  589.                 $output .=              "<span class='time'><i class='fa fa-calendar'></i>".get_the_date('j M Y')."</span>";
  590.                 $output .=              "<span class='author'><i class='fa fa-user'></i>".get_the_author()."";
  591.                 $output .=          "</div>";
  592.                 $output .=          "<p>".get_the_excerpt()."</p>";
  593.                 $output .=      "</li>";
  594.                 endwhile;
  595.                 $output .=  "</ul>";
  596.                 $output .="</div>";
  597.                 wp_reset_query();
  598.                 return $output;
  599.                 break;
  600.             case 'style7':
  601.                 $qry[1] = 3;
  602.                 $qry[2] = $limit-1;
  603.                 $qry['total'] = array_sum($qry);
  604.  
  605.                 $paged = (get_query_var('page')) ? get_query_var('page') : 1;
  606.                 $onum = ($qry['total'] * ($paged - 1));
  607.                 $type = "post";
  608.  
  609.                 $output   = "<div class='style3 group ".$color." ramadhan'>";
  610.                 $output  .= "<div class='group-title'>";
  611.                 $output  .= "   <h2><i class='fa fa-folder-open'></i><a href=$category_link)>".str_replace("-", " ", $category)."</a></h2>";
  612.                 $output  .= "   <div  class='feed' ><a href=$category_feed_link data-toggle='tooltip' data-placement='left' title='Belangganan kategori ini'><i class='fa fa-rss'></i></a></div>";
  613.                 $output  .= "</div>";
  614.                 $output  .= "<div class='group-content' style='background:url(".get_template_directory_uri()."/images/rmd.gif)'>";
  615.                 $output  .= "<div class='row'>";
  616.                 $output  .= "<div class='col-md-4 group-banner'>";
  617.                 $output  .= "<img src='".get_template_directory_uri()."/images/rmd-title.png'></div>";
  618.                
  619.  
  620.                 $offset = ($paged > 1) ? ($onum) : 0;
  621.                 query_posts("post_type=$type&category_name=$category&posts_per_page=$qry[total]&paged=$paged&showposts=$qry[1]&offset=$offset");
  622.                
  623.                 $output  .= "<div class='col-md-4'>";
  624.                 $output  .=     "<ul class='style2 articles'>";
  625.                
  626.                 if (have_posts()) : while (have_posts()) : the_post();
  627.                    
  628.                     $output .= "<li>";
  629.                     $output .=      "<figure class='thumbnail'>";
  630.                     $postimage = post_image();
  631.                     if(!empty($postimage)):
  632.                         $output .=  "<img src='".resize_image(post_image(),70,70)."' alt='".esc_html(get_the_title())."' width=70 height=70>";
  633.                     else:
  634.                         $output .=  "<img src='".get_template_directory_uri()."/images/placeholder-70.jpg' alt='".esc_html(get_the_title())."' width=70 height=70>";
  635.                     endif;
  636.                     $output .=      "</figure>";
  637.  
  638.                     $output .=      "<div class='meta'>";
  639.                     $output .=          "<h3><a href='".get_permalink()."' title='".esc_html(get_the_title())."'>".string_limit_words(esc_html(get_the_title()),8)."</a></h3>";
  640.                     $output .=          "<div>";
  641.                     $output .=              "<span class='time'><i class='fa fa-calendar'></i>".get_the_date('j M Y')."</span>";
  642.                     $output .=              "<span class='author'><i class='fa fa-user'></i>".get_the_author()."";
  643.                     $output .=          "</div>";
  644.                     $output .=      "</div>";
  645.                     $output .=  "</li>";
  646.  
  647.                 endwhile;endif;
  648.                 $output .= "</ul></div>";
  649.  
  650.                 $offset = $qry[1] + (($paged > 1) ? $onum : 0);
  651.                 query_posts("post_type=$type&category_name=$category&posts_per_page=$qry[total]&offset=$offset&showposts=$qry[2]");
  652.                 $output  .= "<div class='col-md-4'>";
  653.                 $output  .=     "<ul class='style1 articles'>";
  654.                 if (have_posts()) : while (have_posts()) : the_post();
  655.                    
  656.                     $output .= "<li>";
  657.                     $output .=      "<figure class='thumbnail'>";
  658.                     $postimage = post_image();
  659.                     if(!empty($postimage)):
  660.                         $output .=  "<img src='".resize_image(post_image(),70,70)."' alt='".esc_html(get_the_title())."' width=70 height=70>";
  661.                     else:
  662.                         $output .=  "<img src='".get_template_directory_uri()."/images/placeholder-70.jpg' alt='".esc_html(get_the_title())."' width=70 height=70>";
  663.                     endif;
  664.                     $output .=      "</figure>";
  665.  
  666.                     $output .=      "<div class='meta'>";
  667.                     $output .=          "<h3><a href='".get_permalink()."' title='".esc_html(get_the_title())."'>".string_limit_words(esc_html(get_the_title()),8)."</a></h3>";
  668.                     $output .=          "<div>";
  669.                     $output .=              "<span class='time'><i class='fa fa-calendar'></i>".get_the_date('j M Y')."</span>";
  670.                     $output .=              "<span class='author'><i class='fa fa-user'></i>".get_the_author()."";
  671.                     $output .=          "</div>";
  672.                     $output .=      "</div>";
  673.                     $output .=  "</li>";
  674.                 endwhile;
  675.                 endif;
  676.                 $output .= "</ul></div></div></div></div>";
  677.  
  678.                 break;
  679.  
  680.             default:
  681.                
  682.                 break;
  683.         }
  684.         wp_reset_query();
  685.  
  686.         return $output;
  687.  
  688.     }
  689.     add_shortcode('post', 'framework_latest_post_sc');
  690.  
  691.     // Slider
  692.     function framework_slider_sc( $atts, $content = null ) {
  693.  
  694.         extract( shortcode_atts( array(
  695.             'category' => '',
  696.             'tag'=>'',
  697.             'limit'=> 5,
  698.         ), $atts) );
  699.         $args =array();
  700.         if(!empty($category)){
  701.             $args["category_name"]=$category;
  702.         }else{
  703.             $args["tag"]=$tag;
  704.         }
  705.         $args["posts_per_page"]=$limit;
  706.         $query = new WP_Query($args);
  707.         $output  ="<div class='slider-container slidervideo'>";
  708.         $output .=  "<div class='flex-slider'>";
  709.         $output .=      "<ul class='slides'>";
  710.         while ($query->have_posts()) : $query->the_post();
  711.         // $category = get_the_category();
  712.         $category = explode(",",get_the_category_list(","));
  713.         $output .=          "<li data-thumb='".resize_image(post_image(),70,60)."'>";
  714.         $output .=              "<img src='".resize_image(post_image(),540,340)."' />";
  715.         $output .=              "<div class='caption'>";
  716.         $output .=                  "<span class=cat><i class='fa fa-folder-open'></i>".$category[0]."</span>";
  717.         $output .=                  "<span class=cat><i class='fa fa-calendar'></i>".get_the_date("j M Y")."</span>";
  718.         $output .=                  "<h3><a href=".get_permalink().">".get_the_title()."</a></h3>";
  719.         $output .=                  "<p>".get_the_excerpt()."</p>";
  720.         $output .=              "</div>";
  721.         $output .=          "</li>";
  722.         endwhile;
  723.  
  724.         $output .=      "</ul>";
  725.         $output .=  "</div>";
  726.         $output .="</div>";
  727.         wp_reset_query();
  728.  
  729.         // Fallback
  730.         $output   .= "<div class='style1 group responsive-group'>";
  731.         $output  .= "<div class='group-title'>";
  732.         $output  .= "   <h2><i class='fa fa-folder-open'></i>Headline</h2>";
  733.         $output  .= "</div>";
  734.         $output  .= "<div class='group-content'>";
  735.         $output  .=     "<ul class='style1 articles'>";
  736.         $query = new WP_Query($args);
  737.         while ($query->have_posts()) : $query->the_post();
  738.             $output .= "<li>";
  739.             $output .=      "<figure class='thumbnail'>";
  740.             $postimage = post_image();
  741.             if(!empty($postimage)):
  742.                 $output .=  "<img src='".resize_image(post_image(),70,70)."' alt='".esc_html(get_the_title())."' width=70 height=70>";
  743.             else:
  744.                 $output .=  "<img src='".get_template_directory_uri()."/images/placeholder-70.jpg' alt='".esc_html(get_the_title())."' width=70 height=70>";
  745.             endif;
  746.             $output .=      "</figure>";
  747.             $output .=      "<div class='meta has-thumb'>";
  748.             $output .=          "<h3><a href='".get_permalink()."' title='".esc_html(get_the_title())."'>".esc_html(get_the_title())."</a></h3>";
  749.             $output .=          "<div>";
  750.             $output .=              "<span class='time'><i class='fa fa-calendar'></i>".get_the_date('j M Y')."</span>";
  751.             $output .=              "<span class='author'><i class='fa fa-user'></i>".get_the_author()."";
  752.             $output .=          "</div>";
  753.             if($style=="style2" && $count==1){
  754.             $output .=          "<p>".get_the_excerpt()."</p>";
  755.             }
  756.             $output .=      "</div>";
  757.             $output .=  "</li>";
  758.  
  759.         endwhile;
  760.  
  761.         $output .= "</ul></div></div>";
  762.         wp_reset_query();
  763.         return $output;
  764.     }
  765.     add_shortcode('slider', 'framework_slider_sc');
  766.  
  767.     function framework_slidervideo_sc( $atts, $content = null ) {
  768.         // $args =array();
  769.         // if(!empty($category)){
  770.         //  $args["category_name"]=$category;
  771.         // }else{
  772.         //  $args["tag"]=$tag;
  773.         // }
  774.         // $args["posts_per_page"]=$limit;
  775.         // $query = new WP_Query($args);
  776.  
  777.         //$videos = get_latest_youtube("hasmiorg",5);
  778.         $videos = get_latest_youtube("UChBixMZeCCgFvCAjVcakLog",5);
  779.         $output   = "<div class='group slidervideo blue'>";
  780.         $output  .=     "<div class='group-title'>";
  781.         $output  .=         "<h2><i class='fa fa-folder-open'></i><a href=http://galeri.hasmi.org/>Gallery Hasmi</a></h2>";
  782.         $output  .=         "<div  class='feed' ><a href='http://galeri.hasmi.org/feed' data-toggle='tooltip' data-placement='left' title='Belangganan kategori ini'><i class='fa fa-rss'></i></a></div>";
  783.         $output  .=     "</div>";
  784.  
  785.         $output  .="<div class='slider-container'>";
  786.         $output .=  "<div class='flex-slider'>";
  787.         $output .=      "<ul class='slides'>";
  788.         foreach($videos as $video):
  789.         // $category = get_the_category();
  790.         // $category = explode(",",get_the_category_list(","));
  791.         $output .=          "<li data-thumb='".resize_image($video["thumbnail"],70,60)."'>";
  792.         $output .=              "<a href=".$video["watch"]." class='fancybox-media videoslide'><img src='".resize_image($video["thumbnail"],540,340)."' width=540 height=340/></a>";
  793.         $output .=              "<div class='caption'>";
  794.         $output .=                  "<h3><a href=".$video["watch"]." target='_blank'>".$video["title"]."</a></h3>";
  795.         $output .=                  "<p>".string_limit_words($video["desc"],20)."</p>";
  796.         $output .=              "</div>";
  797.         $output .=          "</li>";
  798.         endforeach;
  799.  
  800.         $output .=      "</ul>";
  801.         $output .=  "</div>";
  802.         $output .="</div>";
  803.         $output .="</div>";
  804.  
  805.         // Fallback
  806.         $output   .= "<div class='style1 responsive-group group blue'>";
  807.         $output  .= "<div class='group-title'>";
  808.         $output  .= "   <h2><i class='fa fa-folder-open'></i><a href=http://galeri.hasmi.org/>Gallery Hasmi</a></h2>";
  809.         $output  .= "   <div  class='feed' ><a href=$category_feed_link data-toggle='tooltip' data-placement='left' title='Belangganan kategori ini'><i class='fa fa-rss'></i></a></div>";
  810.         $output  .= "</div>";
  811.         $output  .= "<div class='group-content'>";
  812.         $output  .=     "<ul class='style1 articles'>";
  813.  
  814.         foreach($videos as $video):
  815.             $output .= "<li>";
  816.             $output .=      "<figure class='thumbnail'>";
  817.             $output .=          "<img src='".resize_image($video["thumbnail"],540,340)."' width=540 height=340/>";
  818.             $output .=      "</figure>";
  819.             $output .=      "<div class='meta has-thumb'>";
  820.             $output .=          "<h3><a href='".$video["watch"]."' title='".$video["title"]."'>".$video["title"]."</a></h3>";
  821.             $output .=      "</div>";
  822.             $output .=  "</li>";
  823.         endforeach;
  824.  
  825.         $output .= "</ul></div></div>";
  826.  
  827.        
  828.         return $output;
  829.     }
  830.     add_shortcode('slidervideo', 'framework_slidervideo_sc');
  831.  
  832.     // Single Tabbed
  833.     function framework_tabbed_sc( $atts, $content = null ) {
  834.  
  835.         extract( shortcode_atts( array(
  836.             'limit'=> 5,
  837.         ), $atts) );
  838.        
  839.         $output .="<div class='group tabbed-nav'>";
  840.         $output .=  "<ul class='tabs'>";
  841.         $output .=      "<li><a href='#terbaru' data-toggle='tab'><i class='fa fa-clock-o'></i> Terbaru</a></li>";
  842.         $output .=      "<li><a href='#populer' data-toggle='tab'><i class='fa fa-heart'></i> Populer</a></li>";
  843.         $output .=      "<li><a href='#pilihan' data-toggle='tab'><i class='fa fa-pencil'></i> Pilihan Editor</a></li>";
  844.         $output .=  "</ul>";
  845.  
  846.         $output .=  "<!-- Tab panes -->";
  847.         $output .=  "<div class='tab-contents'>";
  848.         $output .=      "<div class='tab-pane' id='pilihan'>";
  849.         $output .=          "<ul class='articles style1'>";
  850.         $query = new WP_Query(array("tag"=>"pilihan-editor","posts_per_page"=>$limit));
  851.         while($query->have_posts()) : $query->the_post();
  852.  
  853.         $output .=              "<li>";
  854.         $output .=                  "<figure class='thumbnail'>";
  855.         if(post_image()){
  856.         $output .=                      "<img src=".resize_image(post_image(),70,60)." alt='thumbnail' width=70 height=60>";
  857.         }else{
  858.         $output .=                      "<img src='".get_template_directory_uri()."/images/placeholder-70.jpg' alt='thumbnail' width=70 height=60>";
  859.         }
  860.         $output .=                  "</figure>";
  861.         $output .=                  "<div class='meta has-thumb'>";
  862.         $output .=                      "<h3><a href=".get_permalink()." title='".esc_html(get_the_title())."'>".string_limit_words(esc_html(get_the_title()),8)."</a></h3>";
  863.         $output .=                      "<span class='time'><i class='fa fa-calendar'></i>".get_the_date("j M Y")."</span><span class='author'><i class='fa fa-user'></i>".get_the_author()."</span>";
  864.         $output .=                  "</div>";
  865.         $output .=              "</li>";
  866.         endwhile;
  867.         wp_reset_query();
  868.         $output .=          "</ul>";
  869.         $output .=      "</div> <!-- pilihan -->";
  870.         $output .=      "<div class='tab-pane fade' id='populer'>";
  871.         if (function_exists('wpp_get_mostpopular')) {
  872.             ob_start();
  873.             wpp_get_mostpopular("range=weekly&limit=4&thumbnail_width=70&thumbnail_height=60&post_html=<li><figure>{thumb}</figure><div><h3>{title}</h3></div></li>");
  874.        
  875.         $output .= $variable = ob_get_clean();
  876.         };
  877.         $output .=      "</div> <!-- populer -->";
  878.         $output .=      "<div class='tab-pane fade in active' id='terbaru'>";
  879.         $output .=          "<ul class='articles style1'>";
  880.         $query = new WP_Query(array("posts_per_page"=>$limit));
  881.         while($query->have_posts()) : $query->the_post();
  882.         $output .=              "<li>";
  883.         $output .=                  "<figure class='thumbnail'>";
  884.         if(post_image()){
  885.         $output .=                      "<img src=".resize_image(post_image(),70,60)." alt='thumbnail' width=70 height=60>";
  886.         }else{
  887.         $output .=                      "<img src='".get_template_directory_uri()."/images/placeholder-70.jpg' alt='thumbnail' width=70 height=60>";
  888.         }
  889.         $output .=                  "</figure>";
  890.         $output .=                  "<div class='meta has-thumb'>";
  891.         $output .=                      "<h3><a href=".get_permalink()." title='".esc_html(get_the_title())."'>".string_limit_words(esc_html(get_the_title()),8)."</a></h3>";
  892.         $output .=                      "<span class='time'><i class='fa fa-calendar'></i>".get_the_date( "j M Y" )."</span><span class='author'><i class='fa fa-user'></i>".get_the_author()."</span>";
  893.         $output .=                  "</div>";
  894.         $output .=              "</li>";
  895.         endwhile;
  896.  
  897.         $output .=          "</ul>";
  898.         $output .=      "</div> <!-- terbaru -->";
  899.         $output .=  "</div> <!-- tab-pane -->";
  900.         $output .="</div><!-- tabbed group -->";
  901.  
  902.         wp_reset_query();
  903.         return $output;
  904.     }
  905.     add_shortcode('tabbed', 'framework_tabbed_sc');
  906.  
  907.  
  908.     function framework_links_sc($atts,$content=null){
  909.         extract( shortcode_atts( array(
  910.             'category'=> '',
  911.             'color'=>'',
  912.             'title'=>'',
  913.             'type'=>'list'
  914.         ), $atts) );
  915.  
  916.         $args = array(
  917.               "category_name"=>$category,
  918.           );
  919.         if($type=="list") $args["link_before"]="<i class='fa fa-link'></i>";
  920.  
  921.         $output   = "<div class='style1 group ".$color." '>";
  922.         $output  .= "<div class='group-title'>";
  923.         $output  .= "   <h2><i class='fa fa-link'></i>".$title."</h2>";
  924.         // if($type!="list"):
  925.         $output  .=     "<div class='feed'>";
  926.         $output  .=         "<a id='car_prev' href='#' class='prev' style='display: inline-block;'><i class='fa fa-chevron-left'></i></a>";
  927.         $output  .=         "<a id='car_next' href='#' class='next' style='display: inline-block;'><i class='fa fa-chevron-right'></i></a>";
  928.         $output  .=     "</div>";
  929.         // endif;
  930.         $output  .= "</div>";
  931.         $output  .= "<div class='group-content'>";
  932.         $output  .=     "<div id='carousel-link'>";
  933.         $tests = get_bookmarks( $args );
  934.         $i = 0;
  935.         foreach( $tests as $link ){
  936.             $open = !($i%9) ? '<div class=car-item><ul>' : ''; //Create open wrapper if count is divisible by 3
  937.             $close = !($i%9) && $i ? '</ul></div>' : ''; //Close the previous wrapper if count is divisible by 3 and greater than 0
  938.             $output .= $close.$open;
  939.             $output .= "<li><a href=".$link->link_url."><i class='fa fa-link'></i> ".$link->link_name."</a></li>";
  940.             $i++;
  941.         }
  942.  
  943.  
  944.         $output  .=     "</div>";
  945.         $output  .= "</div></div>";
  946.  
  947.         return $output;
  948.     }
  949.     add_shortcode('link', 'framework_links_sc');
  950.     /* -------------------------------------------------- */
  951.     /*  Content Tabs
  952.     /* -------------------------------------------------- */
  953.  
  954.     // Tabs container
  955.     function framework_content_tabgroup_sc( $atts, $content = null ) {
  956.  
  957.         if( !$GLOBALS['tabs_groups'] )
  958.             $GLOBALS['tabs_groups'] = 0;
  959.            
  960.         $GLOBALS['tabs_groups']++;
  961.  
  962.         $GLOBALS['tab_count'] = 0;
  963.  
  964.         $tabs_count = 1;
  965.  
  966.         do_shortcode( $content );
  967.  
  968.         if( is_array( $GLOBALS['tabs'] ) ) {
  969.             $i=0;
  970.             foreach( $GLOBALS['tabs'] as $tab ) {
  971.                 $active = ($i==0)?"active":"";
  972.                 $tabs[] = '<li class='.$active.'><a href="#tab-' . $GLOBALS['tabs_groups'] . '-' . $tabs_count . '" data-toggle="tab">' . $tab['title'] . '</a></li>';
  973.                 $panes[] = '<div id="tab-' . $GLOBALS['tabs_groups'] . '-' . $tabs_count++ . '" class="tab-pane '.$active.'">' . do_shortcode( $tab['content'] ) . '</div>';
  974.                 $i++;
  975.             }
  976.  
  977.             $return = "\n". '<ul class="nav nav-tabs">' . implode( "\n", $tabs ) . '</ul>' . "\n" . '<div class="tab-content">' . implode( "\n", $panes ) . '</div>' . "\n";
  978.         }
  979.  
  980.         return $return;
  981.  
  982.     }
  983.     add_shortcode('tabgroup', 'framework_content_tabgroup_sc');
  984.     // Single tab
  985.     function framework_content_tab_sc( $atts, $content = null ) {
  986.  
  987.         extract( shortcode_atts( array(
  988.             'title' => ''
  989.         ), $atts) );
  990.  
  991.         $i = $GLOBALS['tab_count'];
  992.  
  993.         $GLOBALS['tabs'][$i] = array( 'title' => sprintf( $title, $GLOBALS['tab_count'] ), 'content' => $content );
  994.  
  995.         $GLOBALS['tab_count']++;
  996.  
  997.     }
  998.     add_shortcode('tab', 'framework_content_tab_sc');
  999.  
  1000.     function framework_social_box_sc( $atts, $content = null ){
  1001.         $output = "<div class='group social-stats'>";
  1002.         $output .=  "<div class='group-content'>";
  1003.         $output .=      "<h2>'Sampaikanlah <br>walau <br>satu ayat'</h2>";
  1004.         $output .=      "<ul>";
  1005.         $output .=          "<li><span class='count'><i class='fa fa-facebook-square'></i></span>Like Page Hasmi dan dapatkan informasi terbaru";
  1006.         $output .=              "<div>";
  1007.         $output .=                  "<a href='".get_option("hasmi_facebook")."' class='btn btn-md btn-primary'>Like</a>";
  1008.         $output .=              "</div>";
  1009.         $output .=          "</li>";
  1010.         $output .=          "<li><span class='count'><i class='fa fa-twitter'></i></span>Follow kami di twitter untuk mendapatkan update terbaru";
  1011.         $output .=              "<div>";
  1012.         $output .=                  "<a href='".get_option("hasmi_twitter")."' class='btn btn-md btn-success'>Follow</a>";
  1013.         $output .=              "</div>";
  1014.         $output .=          "</li>";
  1015.         $output .=          "<li><span class='count'><i class='fa fa-rss'></i></span>Dapatkan artikel terbaru Hasmi di email anda";
  1016.         $output .=              "<div>";
  1017.         $output .=                  "<a href='".home_url()."/feed' class='btn btn-md btn-warning'>Subscribe</a>";
  1018.         $output .=              "</div>";
  1019.         $output .=          "</li>";
  1020.         $output .=      "</ul>";
  1021.         $output .=  "</div>";
  1022.         $output .= "</div>";
  1023.  
  1024.         return $output;
  1025.  
  1026.     }
  1027.     add_shortcode('socialbox', 'framework_social_box_sc');
  1028.     /* -------------------------------------------------- */
  1029.     /*  Editor Fix (Raw)
  1030.     /* -------------------------------------------------- */
  1031.  
  1032.     function my_formatter( $content ) {
  1033.  
  1034.         $new_content = '';
  1035.         $pattern_full = '{(\[raw\].*?\[/raw\])}is';
  1036.         $pattern_contents = '{\[raw\](.*?)\[/raw\]}is';
  1037.         $pieces = preg_split( $pattern_full, $content, -1, PREG_SPLIT_DELIM_CAPTURE );
  1038.  
  1039.         foreach ( $pieces as $piece ) {
  1040.  
  1041.             if ( preg_match( $pattern_contents, $piece, $matches ) ) {
  1042.                 $new_content .= $matches[1];
  1043.             } else {
  1044.                 $new_content .= wptexturize( wpautop( $piece ) );
  1045.             }
  1046.  
  1047.         }
  1048.  
  1049.         return $new_content;
  1050.  
  1051.     }
  1052.     remove_filter('the_content', 'wpautop');
  1053.     remove_filter('the_content', 'wptexturize');
  1054.     add_filter('the_content', 'my_formatter', 99);
  1055.  
  1056. /* ---------------------------------------------------------------------- */
  1057. /*  TinyMCE Buttons
  1058. /* ---------------------------------------------------------------------- */
  1059.  
  1060. function add_shortcodes_button() {
  1061.  
  1062.     if ( !current_user_can('edit_posts') && !current_user_can('edit_pages') )
  1063.         return;
  1064.  
  1065.     if ( get_user_option('rich_editing') == 'true' ) {
  1066.         add_filter('mce_external_plugins', 'add_shortcodes_tinymce_plugin');
  1067.         add_filter('mce_buttons', 'register_shortcodes_button');
  1068.     }
  1069.  
  1070. }
  1071. add_action('init', 'add_shortcodes_button');
  1072.  
  1073. function register_shortcodes_button( $buttons ) {
  1074.  
  1075.     array_push( $buttons, '|', 'framework_shortcodes' );
  1076.  
  1077.     return $buttons;
  1078.  
  1079. }
  1080.  
  1081. function add_shortcodes_tinymce_plugin( $plugin_array ) {
  1082.  
  1083.     $plugin_array['framework_shortcodes'] = get_template_directory_uri() . '/include/tinymce/tinymce.js';
  1084.  
  1085.     return $plugin_array;
  1086.  
  1087. }
  1088.  
  1089. function my_refresh_mce( $ver ) {
  1090.  
  1091.     $ver += 3;
  1092.  
  1093.     return $ver;
  1094.  
  1095. }
  1096. add_filter('tiny_mce_version', 'my_refresh_mce');
  1097.  
  1098.  
  1099. /* ---------------------------------------------------------------------- */
  1100. /*  Quicktags
  1101. /* ---------------------------------------------------------------------- */
  1102.  
  1103. function aw_quicktags() {
  1104.  
  1105.     wp_enqueue_script( 'aw_quicktags', get_template_directory_uri() . '/include/tinymce/quicktags.js', array('quicktags') );
  1106.  
  1107. }
  1108. add_action('admin_print_scripts', 'aw_quicktags');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement