Example #1
0
/**
 * 
 *
 * @package Kopa
 * @subpackage Core
 * @author thethangtran <*****@*****.**>
 * @since 1.0.0
 *      
 */
function kopa_shortcode_tabs($atts, $content = null)
{
    extract(shortcode_atts(array('style' => 'horizontal', 'width' => 200), $atts));
    $style = !empty($atts['style']) && in_array($atts['style'], array('horizontal', 'vertical')) ? $atts['style'] : 'horizontal';
    $width = '';
    if ('vertical' == $style) {
        $width = !empty($atts['width']) ? (int) $atts['width'] : 200;
        $width = sprintf('style="width:%spx;"', $width > 0 ? $width : 200);
    }
    $items = KopaUtil::get_shortcode($content, true, array('tab'));
    $navs = array();
    $panels = array();
    if ($items) {
        $active = 'active';
        foreach ($items as $item) {
            $title = $item['atts']['title'];
            $item_id = 'tab-' . wp_generate_password(4, false, false);
            $navs[] = sprintf('<li><a href="#%s">%s</a></li>', $item_id, do_shortcode($title));
            $panels[] = sprintf('<div id="%s">%s</div>', $item_id, do_shortcode($item['content']));
            $active = '';
        }
    }
    $output = sprintf('<div class="kp-tabs tab-%s">', $style);
    $output .= sprintf('<ul %s>', $width);
    $output .= implode('', $navs);
    $output .= '</ul>';
    $output .= implode('', $panels);
    $output .= '</div>';
    return apply_filters('kopa_shortcode_tabs', $output);
}
Example #2
0
/**
 * 
 *
 * @package Kopa
 * @subpackage Core
 * @author thethangtran <*****@*****.**>
 * @since 1.0.0
 *      
 */
function kopa_shortcode_row($atts, $content = null)
{
    extract(shortcode_atts(array(), $atts));
    $items = KopaUtil::get_shortcode($content, true, array('col'));
    $panels = array();
    if ($items) {
        foreach ($items as $item) {
            $panels[] = sprintf('<div class="col-sm-%s">%s</div>', $item['atts']['col'], do_shortcode($item['content']));
        }
    }
    $output = '<div class="row clearfix">';
    $output .= implode('', $panels);
    $output .= '</div>';
    return apply_filters('kopa_shortcode_row', $output);
}
Example #3
0
/**
 * 
 *
 * @package Kopa
 * @subpackage Core
 * @author thethangtran <*****@*****.**>
 * @since 1.0.0
 *      
 */
function kopa_shortcode_accordions($atts, $content = null)
{
    extract(shortcode_atts(array(), $atts));
    $items = KopaUtil::get_shortcode($content, true, array('accordion'));
    $panels = array();
    if ($items) {
        foreach ($items as $item) {
            $title = $item['atts']['title'];
            $tmp = sprintf('<h3>%s</h3>', $title);
            $tmp .= sprintf('<div>%s</div>', do_shortcode($item['content']));
            $panels[] = $tmp;
        }
    }
    $output = '<div class="kp-accordion style-2">';
    $output .= implode('', $panels);
    $output .= '</div>';
    return apply_filters('kopa_shortcode_tabs', $output);
}
Example #4
0
 /**
  * @package Kopa
  * @subpackage Core
  * @author thethangtran <*****@*****.**>
  * @since 1.0.0         
  */
 function kopa_load_post()
 {
     check_ajax_referer('kopa_load_post', 'ajax_nonce');
     $post_id = $_GET['post_id'];
     $post_format = $_GET['post_format'];
     $shortcodes = array();
     switch ($post_format) {
         case 'audio':
             $shortcodes = array('audio', 'soundcloud');
             break;
         case 'gallery':
             $shortcodes = array('gallery');
             break;
         case 'video':
             $shortcodes = array('video', 'youtube', 'vimeo');
             break;
     }
     if (!empty($shortcodes)) {
         global $post;
         $post = get_post($post_id);
         $items = KopaUtil::get_shortcode($post->post_content, true, $shortcodes);
         if (!empty($items)) {
             foreach ($items as $item) {
                 echo do_shortcode($item['shortcode']);
             }
         } else {
             echo do_shortcode($post->post_content);
         }
         wp_reset_query();
         wp_reset_postdata();
     } else {
         _e('Content load found', kopa_get_domain());
     }
     exit;
 }
Example #5
0
        ?>
>
                                <div class="item clearfix">
                                    <?php 
        if ('full' != $exceprt_type && !is_search()) {
            if ($metadata['formatted']) {
                $shortcode = NULL;
                switch ($post_format) {
                    case 'video':
                        $shortcode = KopaUtil::get_shortcode($post->post_content, false, array('vimeo', 'youtube', 'video'));
                        break;
                    case 'audio':
                        $shortcode = KopaUtil::get_shortcode($post->post_content, false, array('audio', 'soundcloud'));
                        break;
                    case 'gallery':
                        $shortcode = KopaUtil::get_shortcode($post->post_content, false, array('gallery'));
                        break;
                }
                if (!empty($shortcode)) {
                    ?>
                                                <div class="kopa-post-content-formated pull-left">
                                                    <?php 
                    echo do_shortcode($shortcode[0]['shortcode']);
                    ?>
                                                </div>
                                                <?php 
                } else {
                    if (has_post_thumbnail()) {
                        $size = 0 == $loop_index ? 'size_09' : 'size_13';
                        $image = KopaImage::get_post_image_src($post_id, $size);
                        ?>