Example #1
0
    function widget($args, $instance)
    {
        extract($args);
        $title = apply_filters('widget_title', empty($instance['title']) ? __('List Videos', 'news-maxx-lite') : $instance['title'], $instance, $this->id_base);
        $query_args['categories'] = $instance['categories'];
        $query_args['relation'] = esc_attr($instance['relation']);
        if (isset($instance['kopa_timestamp'])) {
            $query_args['date_query'] = $instance['kopa_timestamp'];
        }
        $query_args['post_format'] = 'post-format-video';
        $query_args['posts_per_page'] = (int) $instance['posts_per_page'];
        $query_args['orderby'] = $instance['orderby'];
        $posts = news_maxx_lite_widget_posttype_build_query($query_args);
        echo $before_widget;
        ?>
        <?php 
        if ($title) {
            ?>
            <h4 class="widget-title"><?php 
            echo $title;
            ?>
</h4>
        <?php 
        } else {
            ?>
            <span class="widget-title no-title"></span>
        <?php 
        }
        ?>

        <?php 
        if ($posts->have_posts()) {
            $index = 0;
            while ($posts->have_posts()) {
                $posts->the_post();
                $index++;
                $li_common = '<li>';
                $li_common .= ' <h6 class="entry-title"><a href="' . get_permalink() . '" title="' . get_the_title() . '"><i class="fa fa-film"></i>' . get_the_title() . '</a></h6>';
                $li_common .= '</li>';
                if (1 === $index) {
                    ?>
                        <article class="last-item">
                        <div class="entry-thumb">
                            <a href="<?php 
                    the_permalink();
                    ?>
" title="<?php 
                    the_title();
                    ?>
"><?php 
                    the_post_thumbnail('news-maxx-lite-video', array('class' => 'img-responsive'));
                    ?>
</a>
                            <a href="<?php 
                    the_permalink();
                    ?>
" title="<?php 
                    the_title();
                    ?>
" class="entry-icon fa fa-play"></a>
                            <div class="meta-box clearfix">
                                <span class="entry-date pull-left"><i class="fa fa-film"></i><?php 
                    the_time(get_option('date_format'));
                    ?>
</span>
                                <span class="entry-meta pull-left">&nbsp;/&nbsp;</span>
                                <span class="entry-author pull-left"><?php 
                    _e('By', 'news-maxx-lite');
                    ?>
 <?php 
                    the_author_posts_link();
                    ?>
</span>
                            </div>
                            <!-- meta-box -->
                        </div>
                        <div class="entry-content">
                            <h6 class="entry-title"><a href="<?php 
                    the_permalink();
                    ?>
" title="<?php 
                    the_title();
                    ?>
"><?php 
                    the_title();
                    ?>
</a></h6>
                        </div>
                    </article>
                    <?php 
                } elseif (2 === $index) {
                    ?>
                        <ul class="older-post clearfix">
                            <?php 
                    echo $li_common;
                    ?>
                    <?php 
                } elseif ($index === $posts->post_count) {
                    ?>
                        <?php 
                    echo $li_common;
                    ?>
                        </ul>
                    <?php 
                } else {
                    ?>
                        <?php 
                    echo $li_common;
                    ?>
                    <?php 
                }
            }
        }
        ?>

    <?php 
        echo $after_widget;
        wp_reset_postdata();
    }
Example #2
0
    function widget($args, $instance)
    {
        extract($args);
        $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base);
        echo $before_widget;
        $query_args['posts_per_page'] = $instance['number_of_article'];
        $tab_args = array();
        if ($instance['popular_title']) {
            $tab_args[] = array('label' => $instance['popular_title'], 'orderby' => 'most_comment');
        }
        if ($instance['latest_title']) {
            $tab_args[] = array('label' => $instance['latest_title'], 'orderby' => 'latest');
        }
        if ($instance['comment_title']) {
            $tab_args[] = array('label' => $instance['comment_title'], 'orderby' => 'most_comment');
        }
        ?>

        <ul class="nav nav-tabs kopa-tabs-1">
            <?php 
        foreach ($tab_args as $k => $tab_arg) {
            ?>
                <li class="<?php 
            if (0 === $k) {
                echo 'active';
            }
            ?>
"><a data-toggle="tab" href="#tab1-<?php 
            echo $this->number . $k;
            ?>
"><?php 
            echo $tab_arg['label'];
            ?>
</a></li>
            <?php 
        }
        ?>
        </ul> <!-- nav-tabs -->

        <div class="tab-content">
            <?php 
        foreach ($tab_args as $k1 => $tab_arg) {
            $query_args['orderby'] = $tab_arg['orderby'];
            if (isset($instance['kopa_timestamp'])) {
                $query_args['date_query'] = $instance['kopa_timestamp'];
            }
            $posts = news_maxx_lite_widget_posttype_build_query($query_args);
            ?>
            <div id="tab1-<?php 
            echo $this->number . $k1;
            ?>
" class="tab-pane<?php 
            if (0 === $k1) {
                echo ' active';
            }
            ?>
">
                <ul class="clearfix">
                    <?php 
            while ($posts->have_posts()) {
                $posts->the_post();
                ?>
                    <li>
                        <article class="entry-item clearfix">
                            <?php 
                if (has_post_thumbnail()) {
                    ?>
                                <div class="entry-thumb">
                                    <a href="<?php 
                    the_permalink();
                    ?>
" title="<?php 
                    the_title();
                    ?>
">
                                        <?php 
                    the_post_thumbnail('news-maxx-lite-topnew', array('class' => 'img-responsive'));
                    ?>
                                    </a>
                                </div>
                            <?php 
                }
                ?>
                            <div class="entry-content">
                                <header>
                                    <?php 
                if (news_maxx_lite_check_title_null(get_the_ID())) {
                    ?>
                                            <span class="entry-date pull-left"><i class="fa <?php 
                    echo news_maxx_lite_get_post_format_icon(get_the_ID());
                    ?>
"></i><?php 
                    the_time(get_option('date_format'));
                    ?>
</span>
                                        <?php 
                } else {
                    ?>
                                            <span class="entry-date pull-left"><i class="fa <?php 
                    echo news_maxx_lite_get_post_format_icon(get_the_ID());
                    ?>
"></i><a href="<?php 
                    the_permalink();
                    ?>
" title="<?php 
                    the_title();
                    ?>
"><?php 
                    the_time(get_option('date_format'));
                    ?>
</a></span>
                                        <?php 
                }
                ?>

                                    <span class="entry-meta">&nbsp;/&nbsp;</span>
                                    <span class="entry-author"><?php 
                _e('By', 'news-maxx-lite');
                ?>
 <?php 
                the_author_posts_link();
                ?>
</span>
                                </header>
                                <h6 class="entry-title"><a href="<?php 
                the_permalink();
                ?>
" title="<?php 
                the_title();
                ?>
"><?php 
                the_title();
                ?>
</a></h6>
                            </div>
                        </article>
                    </li>
                    <?php 
            }
            ?>
                </ul>
            </div>
            <?php 
        }
        ?>
        </div><!-- tab-content -->

    <?php 
        echo $after_widget;
        wp_reset_postdata();
    }
    function widget($args, $instance)
    {
        extract($args);
        $title = apply_filters('widget_title', empty($instance['title']) ? __('List Articles Carousel', 'news-maxx-lite') : $instance['title'], $instance, $this->id_base);
        $limit = (int) $instance['limit'];
        $posts_per_page = (int) $instance['posts_per_page'];
        $query_args['categories'] = $instance['categories'];
        $query_args['relation'] = esc_attr($instance['relation']);
        $query_args['tags'] = $instance['tags'];
        $query_args['posts_per_page'] = (int) $instance['posts_per_page'];
        $query_args['orderby'] = $instance['orderby'];
        if (isset($instance['kopa_timestamp'])) {
            $query_args['date_query'] = $instance['kopa_timestamp'];
        }
        $posts = news_maxx_lite_widget_posttype_build_query($query_args);
        $categories = $instance['categories'];
        $display = $instance['display'];
        $slideSpeed = (int) $instance['slide_speed'];
        ?>

                <?php 
        if ('grid_layout_random_flexible_size' === $display) {
            ?>
                <div class="widget kopa masonry-list-widget">
                    <?php 
            if ($title) {
                ?>
                    <h4 class="widget-title"><?php 
                echo $title;
                ?>
</h4>
                    <?php 
            }
            ?>
                    <div class="masonry-wrapper">
                        <?php 
            if ($posts->have_posts()) {
                $count = 1;
                ?>
                        <input type='hidden' id='current_page-<?php 
                echo $this->number;
                ?>
' />
                        <input type='hidden' id='show_per_page-<?php 
                echo $this->number;
                ?>
' />
                        <ul class="clearfix masonry-list" id="kopa-masonry-<?php 
                echo $this->number;
                ?>
" data-id="#kopa-masonry-<?php 
                echo $this->number;
                ?>
" data-currentpage="#current_page-<?php 
                echo $this->number;
                ?>
" data-pagenavigation="#page_navigation_<?php 
                echo $this->number;
                ?>
" data-showperpage="#show_per_page-<?php 
                echo $this->number;
                ?>
">
                            <?php 
                while ($posts->have_posts()) {
                    $posts->the_post();
                    if (2 === $count || 3 === $count) {
                        $li_class = 'masonry-item width-2 height-2';
                    } else {
                        if (4 === $count) {
                            $li_class = 'masonry-item width-3 height-2';
                            $count = 0;
                        } else {
                            $li_class = 'masonry-item';
                        }
                    }
                    ?>
                            <li class="<?php 
                    echo $li_class;
                    ?>
">
                                <?php 
                    //if ( has_post_thumbnail()) :
                    ?>
                                <a href="<?php 
                    the_permalink();
                    ?>
" title="<?php 
                    the_title();
                    ?>
">
                                    <?php 
                    if (2 === $count || 3 === $count) {
                        the_post_thumbnail('news-maxx-lite-masonry-item-width-2-height-2', array('class' => 'img-responsive'));
                    } else {
                        if (4 === $count) {
                            the_post_thumbnail('news-maxx-lite-masonry-item-width-3-height-2', array('class' => 'img-responsive'));
                            $count = 0;
                        } else {
                            the_post_thumbnail('news-maxx-lite-masonry-item', array('class' => 'img-responsive'));
                        }
                    }
                    ?>
                                </a>
                                <?php 
                    //endif;
                    ?>
                                <h4 class="entry-title"><a href="<?php 
                    the_permalink();
                    ?>
" title="<?php 
                    the_title();
                    ?>
"><?php 
                    the_title();
                    ?>
</a></h4>
                            </li>
                            <?php 
                    $count++;
                    ?>
                        <?php 
                }
                ?>
                    </ul>
                <?php 
            }
            ?>
            </div>
            <div class="pagination clearfix">
                <ul class="page-numbers clearfix" id='page_navigation_<?php 
            echo $this->number;
            ?>
'>
                </ul><!--page-numbers-->
            </div>
        </div>
    <?php 
        }
        ?>

    <?php 
        if ('grid_with_3items_per_page' === $display) {
            ?>
    <div class="widget kopa-carousel-list-2-widget">
     <?php 
            if (!empty($title)) {
                ?>
     <h4 class="widget-title"><?php 
                echo $title;
                ?>
</h4>
     <?php 
            }
            ?>
     <div class="owl-carousel kopa-owl-carousel-1" data-autoplay="<?php 
            echo $instance['is_auto_play'];
            ?>
" data-slidespeed="<?php 
            echo $slideSpeed;
            ?>
">
        <?php 
            if ($posts->have_posts()) {
                $i = 0;
                $before_item = '<div class="item"><ul>';
                $after_item = '</ul></div>';
                while ($posts->have_posts()) {
                    $posts->the_post();
                    //item html
                    $item_html = '<li>';
                    $item_html .= '<article class="entry-item">';
                    if (has_post_thumbnail()) {
                        $item_html .= '<div class="entry-thumb">';
                        $item_html .= '<a href="' . get_permalink() . '" title="' . get_the_title() . '">' . the_post_thumbnail('news-maxx-lite-article-list-carousel', array('class' => 'img-responsive')) . '</a>';
                        $item_html .= '</div>';
                    }
                    $item_html .= '<div class="entry-content">';
                    $item_html .= '<span class="entry-date"><i class="fa fa-pencil-square-o"></i>' . get_the_time(get_option('date_format')) . '</span>';
                    $item_html .= '<h6 class="entry-title"><a href="' . get_permalink() . '" title="' . get_the_title() . '">' . get_the_title() . '</a></h6>';
                    $item_html .= '</div>';
                    $item_html .= '</article>';
                    $item_html .= '</li>';
                    if ($i % 3 == 0) {
                        echo $before_item;
                    }
                    echo $item_html;
                    if ($i % 3 == 2) {
                        echo $after_item;
                    }
                    $i++;
                }
                //Check in case don't have multiple of 3 items
                if ($i % 3 != 0) {
                    echo $after_item;
                }
            }
            ?>
</div>
</div>
<?php 
        }
        wp_reset_postdata();
    }
    function widget($args, $instance)
    {
        extract($args);
        $title = apply_filters('widget_title', empty($instance['title']) ? __('NEW GALLERY', 'news-maxx-lite') : $instance['title'], $instance, $this->id_base);
        $args['categories'] = $instance['categories'];
        $args['posts_per_page'] = (int) $instance['posts_per_page'];
        $args['post_format'] = 'post-format-gallery';
        if (isset($instance['kopa_timestamp'])) {
            $args['date_query'] = $instance['kopa_timestamp'];
        }
        $posts = news_maxx_lite_widget_posttype_build_query($args);
        ?>
            <div class="widget kopa-gallery-widget">
                <?php 
        if (!empty($title)) {
            ?>
                    <h4 class="widget-title"><?php 
            echo $title;
            ?>
</h4>
                <?php 
        }
        ?>
                <?php 
        if ($posts->have_posts()) {
            ?>
                        <ul class="clearfix">
                            <?php 
            while ($posts->have_posts()) {
                $posts->the_post();
                ?>
                                    <li><a href="<?php 
                the_permalink();
                ?>
" title="<?php 
                the_title();
                ?>
"><?php 
                the_post_thumbnail('news-maxx-lite-gallery', array('class' => 'img-responsive'));
                ?>
</a></li>
                                <?php 
            }
            ?>
                        </ul>
                    <?php 
        }
        ?>
            </div>
    <?php 
        wp_reset_postdata();
    }
    function widget($args, $instance)
    {
        extract($args);
        $title = apply_filters('widget_title', empty($instance['title']) ? __('List Articles', 'news-maxx-lite') : $instance['title'], $instance, $this->id_base);
        $query_args['categories'] = $instance['categories'];
        $query_args['relation'] = esc_attr($instance['relation']);
        $query_args['tags'] = $instance['tags'];
        $query_args['posts_per_page'] = (int) $instance['posts_per_page'];
        if (isset($instance['kopa_timestamp'])) {
            $query_args['date_query'] = $instance['kopa_timestamp'];
        }
        $query_args['orderby'] = $instance['orderby'];
        $limit = $instance['limit'];
        $type = $instance['display_type'];
        $posts = news_maxx_lite_widget_posttype_build_query($query_args);
        ?>

<?php 
        if ('grid_2columns_with_featured_style2' === $type) {
            ?>
            <div class="widget kopa-article-list-3-widget">
                <h4 class="widget-title"><?php 
            echo esc_attr($title);
            ?>
</h4>
                <div class="widget-inner clearfix">
                <?php 
            $count = 0;
            $next = true;
            ?>
                <?php 
            while ($posts->have_posts()) {
                $posts->the_post();
                ?>
                <?php 
                if (0 === $count) {
                    ?>
                    <article class="last-item">
                        <?php 
                    //if ( has_post_thumbnail() ) :
                    ?>
                        <div class="entry-thumb">
                            <a href="<?php 
                    the_permalink();
                    ?>
" title="<?php 
                    the_title();
                    ?>
">
                                <?php 
                    the_post_thumbnail('news-maxx-lite-article-list-cat-2column-feature2', array('class' => 'img-responsive'));
                    ?>
                            </a>
                        </div>
                        <?php 
                    //endif;
                    ?>
<!-- entry-thumb -->
                        <div class="entry-content">
                            <h6 class="entry-title" itemscope="" itemtype="http://schema.org/Event"><a itemprop="name" href="<?php 
                    the_permalink();
                    ?>
" title="<?php 
                    the_title();
                    ?>
"><?php 
                    the_title();
                    ?>
</a></h6>
                        </div>
                        <!-- entry-content -->
                    </article>
                    <!-- last-item -->
                    <?php 
                } else {
                    if ($next) {
                        echo '<ul class="older-post clearfix">';
                        $next = false;
                    }
                    ?>
                    <li>
                        <article class="entry-item clearfix">
                            <?php 
                    if (has_post_thumbnail()) {
                        ?>
                            <div class="entry-thumb">
                                <a href="<?php 
                        the_permalink();
                        ?>
" title="<?php 
                        the_title();
                        ?>
">
                                    <?php 
                        the_post_thumbnail('news-maxx-lite-topnew', array('class' => 'img-responsive'));
                        ?>
                                </a>
                            </div>
                            <?php 
                    }
                    ?>
<!-- entry-thumb -->
                            <div class="entry-content<?php 
                    if (!has_post_thumbnail()) {
                        echo ' no-thumbnail';
                    }
                    ?>
">
                                <header>
                                    <?php 
                    if (news_maxx_lite_check_title_null(get_the_ID())) {
                        ?>
                                        <span class="entry-date"><i class="fa <?php 
                        echo news_maxx_lite_get_post_format_icon(get_the_ID());
                        ?>
"></i><?php 
                        the_time(get_option('date_format'));
                        ?>
</span>
                                        <?php 
                    } else {
                        ?>
                                        <span class="entry-date"><a href="<?php 
                        the_permalink();
                        ?>
" title="<?php 
                        the_title();
                        ?>
"><i class="fa <?php 
                        echo news_maxx_lite_get_post_format_icon(get_the_ID());
                        ?>
"></i><?php 
                        the_time(get_option('date_format'));
                        ?>
</a></span>
                                        <?php 
                    }
                    ?>
                                    <span class="entry-meta">&nbsp;/&nbsp;</span>
                                    <span class="entry-author"><?php 
                    _e('By', 'news-maxx-lite');
                    ?>
 <?php 
                    the_author_posts_link();
                    ?>
</span>
                                </header>
                                <h6 class="entry-title" itemscope="" itemtype="http://schema.org/Event"><a href="<?php 
                    the_permalink();
                    ?>
" title="<?php 
                    the_title();
                    ?>
" itemprop="name"><?php 
                    the_title();
                    ?>
</a></h6>
                            </div>
                        </article>
                        <!-- entry-item -->
                    </li>

                    <?php 
                    if ($count === $posts->post_count - 1) {
                        echo '</ul>';
                    }
                }
                ?>
                <?php 
                $count++;
            }
            ?>
                </div>
            </div>
        <?php 
        }
        ?>

    <?php 
        wp_reset_postdata();
    }
    function widget($args, $instance)
    {
        extract($args);
        $title = apply_filters('widget_title', empty($instance['title']) ? __('List Articles', 'news-maxx-lite') : $instance['title'], $instance, $this->id_base);
        $query_args['categories'] = $instance['categories'];
        $query_args['relation'] = esc_attr($instance['relation']);
        $query_args['tags'] = $instance['tags'];
        $query_args['posts_per_page'] = (int) $instance['posts_per_page'];
        if (isset($instance['kopa_timestamp'])) {
            $query_args['date_query'] = $instance['kopa_timestamp'];
        }
        $query_args['orderby'] = $instance['orderby'];
        $limit = $instance['limit'];
        $posts = news_maxx_lite_widget_posttype_build_query($query_args);
        ?>

        <div class="widget kopa-article-list-1-widget clearfix">
            <h4 class="widget-title"><?php 
        echo $title;
        ?>
</h4>
            <?php 
        if ($posts->have_posts()) {
            $index = 0;
            while ($posts->have_posts()) {
                $posts->the_post();
                $index++;
                $li_common = '<li>';
                $li_common .= '<article class="entry-item clearfix">';
                $li_common .= '<div class="entry-content">';
                $li_common .= '<header>';
                if (news_maxx_lite_check_title_null(get_the_ID())) {
                    $li_common .= '<span class="entry-date"><i class="fa ' . news_maxx_lite_get_post_format_icon(get_the_ID()) . '"></i>' . get_the_time(get_option('date_format')) . '</span>';
                } else {
                    $li_common .= '<span class="entry-date"><i class="fa ' . news_maxx_lite_get_post_format_icon(get_the_ID()) . '"></i><a href="' . get_permalink() . '" title="' . get_the_title() . '">' . get_the_time(get_option('date_format')) . '</a></span>';
                }
                $li_common .= '<span class="entry-meta">&nbsp;/&nbsp;</span>';
                $li_common .= '<span class="entry-author">' . __("By ", 'news-maxx-lite') . '<a href="' . get_author_posts_url(get_the_author_meta('ID')) . '">' . get_the_author_meta('display_name') . '</a></span>';
                $li_common .= '</header>';
                $li_common .= '<h6 class="entry-title"><a href="' . get_permalink() . '" title="' . get_the_title() . '">' . get_the_title() . '</a></h6>';
                $li_common .= '</div>';
                $li_common .= '</article>';
                $li_common .= '</li>';
                if (1 === $index) {
                    ?>
                           <article class="last-item clearfix">
                               <?php 
                    if (has_post_thumbnail()) {
                        ?>
                                   <div class="entry-thumb">
                                       <a href="<?php 
                        the_permalink();
                        ?>
" title="<?php 
                        the_title();
                        ?>
">
                                           <?php 
                        the_post_thumbnail('news-maxx-lite-article-list', array('class' => 'img-responsive'));
                        ?>
                                       </a>
                                   </div>
                               <?php 
                    }
                    ?>
<!-- entry-thumb -->
                               <div class="entry-content">
                                   <header>
                                       <span class="entry-date pull-left"><i class="fa <?php 
                    echo news_maxx_lite_get_post_format_icon(get_the_ID());
                    ?>
"></i><?php 
                    the_time(get_option('date_format'));
                    ?>
</span>
                                   </header>
                                   <h6 class="entry-title"><a href="<?php 
                    the_permalink();
                    ?>
" title="<?php 
                    the_title();
                    ?>
"><?php 
                    the_title();
                    ?>
</a></h6>
                                   <?php 
                    global $post;
                    ?>
                                   <p><?php 
                    echo news_maxx_lite_get_the_excerpt_for_widget($post->post_excerpt, $post->post_content, $limit);
                    ?>
</p>
                                   <a href="<?php 
                    the_permalink();
                    ?>
" title="<?php 
                    the_title();
                    ?>
" class="more-link"><span><?php 
                    _e('Read more', 'news-maxx-lite');
                    ?>
</span></a>
                               </div>
                               <!-- entry-content -->
                           </article>
                           <!-- last-item -->
                       <?php 
                } elseif (2 === $index) {
                    ?>
                           <ul class="older-post clearfix">
                               <?php 
                    echo $li_common;
                    ?>
                       <?php 
                } elseif ($index === $posts->post_count) {
                    ?>
                                <?php 
                    echo $li_common;
                    ?>
                           </ul>
                       <?php 
                } else {
                    ?>
                        <?php 
                    echo $li_common;
                    ?>
                       <?php 
                }
            }
        }
        ?>
        </div>



    <?php 
        wp_reset_postdata();
    }