Ejemplo n.º 1
0
    /**
     * Front-end display of widget.
     *
     * @see WP_Widget::widget()
     *
     * @param array $args     Widget arguments.
     * @param array $instance Saved values from database.
     */
    public function widget($hamza_lite_args, $hamza_lite_instance)
    {
        extract($hamza_lite_args);
        $hamza_lite_id = intval($hamza_lite_instance['post_list']);
        $hamza_lite_read_more = $hamza_lite_instance['read_more_text'];
        $hamza_lite_excerpt_char = absint($hamza_lite_instance['excerpt_character']);
        $hamza_lite_qry = new WP_Query("p={$hamza_lite_id}");
        if ($hamza_lite_qry->have_posts()) {
            echo $before_widget;
            while ($hamza_lite_qry->have_posts()) {
                $hamza_lite_qry->the_post();
                ?>
                <div class="hamza-lite-featured clearfix">                
                    <div class="hamza-lite-featured-content">
                        <?php 
                echo $before_title . apply_filters('the_title', get_the_title()) . $after_title;
                ?>
                    
                        <div class="hamza_lite-featured-excerpt"><?php 
                echo hamza_lite_excerpt(get_the_content(), $hamza_lite_excerpt_char);
                ?>
</div>
                        <?php 
                if ($hamza_lite_read_more) {
                    ?>
                            <div class="hamza_lite-featured-readmore">
                                <a href="<?php 
                    the_permalink();
                    ?>
" class="bttn" title="<?php 
                    the_title();
                    ?>
"><?php 
                    echo esc_attr($hamza_lite_read_more);
                    ?>
</a>
                            </div>
                        <?php 
                }
                ?>
                    </div>
                </div>            
                <?php 
            }
            echo $after_widget;
            wp_reset_postdata();
        }
    }
Ejemplo n.º 2
0
    /**
     * Front-end display of widget.
     *
     * @see WP_Widget::widget()
     *
     * @param array $args     Widget arguments.
     * @param array $instance Saved values from database.
     */
    public function widget($hamza_lite_args, $hamza_lite_instance)
    {
        extract($hamza_lite_args);
        $hamza_lite_number_of_post = $hamza_lite_instance['number_of_post'] > 0 ? $hamza_lite_instance['number_of_post'] : 3;
        $hamza_lite_display_title = $hamza_lite_instance['display_title'];
        $hamza_lite_category = intval($hamza_lite_instance['category_list']);
        $hamza_lite_category = $hamza_lite_category == 0 ? 1 : $hamza_lite_category;
        $hamza_lite_display_thumbnail = $hamza_lite_instance['show_post_thumbnail'];
        $hamza_lite_post_date = $hamza_lite_instance['show_post_date'];
        $hamza_lite_recent_arg = array('post_type' => 'post', 'cat' => $hamza_lite_category, 'post_status' => 'publish');
        //var_dump($recent_arg);
        $hamza_lite_recent_qry = new WP_Query($hamza_lite_recent_arg);
        if ($hamza_lite_recent_qry->have_posts()) {
            echo $before_widget;
            // Check if title needs to be shown
            if (isset($hamza_lite_display_title)) {
                echo $before_title . $hamza_lite_display_title . $after_title;
            }
            ?>
            <div id="vertical-slide">
                <div class="view-silde">
                    <?php 
            while ($hamza_lite_recent_qry->have_posts()) {
                $hamza_lite_recent_qry->the_post();
                $hamza_lite_img_url = wp_get_attachment_image_src(get_post_thumbnail_id(), 'hamza-lite-recent-post-thumbnail', true);
                ?>
                        <div class="hamza_lite-recent-rightdivs clearfix">
                            <?php 
                $stt++;
                if ($hamza_lite_display_thumbnail) {
                    if (has_post_thumbnail()) {
                        ?>
                                    <div class="hamza_lite-recent-rightbar-img">
                                        <a href="<?php 
                        the_permalink();
                        ?>
"><img src="<?php 
                        echo esc_url($hamza_lite_img_url[0]);
                        ?>
" alt="<?php 
                        the_title();
                        ?>
" /></a>
                                    </div>
                                <?php 
                    } else {
                        ?>
                                    <div class="hamza_lite-recent-rightbar-img">
                                        <a href="<?php 
                        the_permalink();
                        ?>
"><img src="<?php 
                        echo esc_url(get_template_directory_uri() . '/images/image65by56.jpg');
                        ?>
" alt="<?php 
                        the_title();
                        ?>
" /></a>
                                    </div>
                                    <?php 
                    }
                }
                ?>
                            <div class="hamza_lite-recent-rightbar-content">
                                <h6 class="hamza_lite-recent-rightbar-title"><a href="<?php 
                the_permalink();
                ?>
"><?php 
                echo hamza_lite_excerpt(get_the_title(), 30);
                ?>
</a></h6>
                                <?php 
                if ($hamza_lite_post_date) {
                    ?>
                                    <div class="hamza_lite-recent-rightbar-date"><?php 
                    echo get_the_date('F j, Y');
                    ?>
</div>
                                <?php 
                }
                ?>
                            </div>
                        </div>
                        <?php 
            }
            ?>
                </div>
            </div>
            <?php 
            echo $after_widget;
            wp_reset_postdata();
            ?>
            <script>
                jQuery(function ($) {
                    $(document).ready(function () {
                        var item = $(".hamza_lite-recent-rightdivs");
                        var view = $(".view-silde");
                        var outer = item.outerHeight(true);
                        var showitem = <?php 
            echo $hamza_lite_number_of_post;
            ?>
;
                        view.css({'max-height': outer * showitem, 'overflow': 'hidden'});
                        setInterval(function () {
                            var pos = view.scrollTop();
                            var height = view.height();
                            var real = view.prop('scrollHeight');
                            if (real - height > pos + 10) {
                                view.animate({
                                    scrollTop: pos + outer
                                }, 1000);
                            } else {
                                view.animate({
                                    scrollTop: 0
                                }, 1000);
                            }
                        }, 3000);
                    });
                });
            </script>
            <?php 
        }
    }
Ejemplo n.º 3
0
        <?php 
    }
    ?>
        <?php 
    $hamza_lite_loop2 = new WP_Query(array('cat' => $hamza_lite_testimonial_category, 'post_status' => 'publish', 'posts_per_page' => 5));
    ?>
            <div class="testimonial-wrap">
                <div class="testimonial-slider">
                <?php 
    while ($hamza_lite_loop2->have_posts()) {
        $hamza_lite_loop2->the_post();
        ?>
       	            <div class="testimonial-slide">
                        <div class="testimonial-excerpt">
                            <?php 
        echo hamza_lite_excerpt(get_the_content(), 140);
        ?>
      		            </div>                                    
                        <div class="testimonial-list clearfix">
      		                <div class="testimonial-thumbnail">
		        		    <?php 
        if (has_post_thumbnail()) {
            $hamza_lite_image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'hamza-lite-testimonial-thumbnail', false);
            ?>
 
                                <img src="<?php 
            echo esc_url($hamza_lite_image[0]);
            ?>
" alt="<?php 
            the_title();
            ?>
Ejemplo n.º 4
0
    /**
     * Front-end display of widget.
     *
     * @see WP_Widget::widget()
     *
     * @param array $args     Widget arguments.
     * @param array $instance Saved values from database.
     */
    public function widget($hamza_lite_args, $hamza_lite_instance)
    {
        extract($hamza_lite_args);
        $hamza_lite_number_of_post = $hamza_lite_instance['number_of_post'] > 0 ? $hamza_lite_instance['number_of_post'] : 3;
        $hamza_lite_display_title = $hamza_lite_instance['display_title'];
        $hamza_lite_category = intval($hamza_lite_instance['category_list']);
        $hamza_lite_category = $hamza_lite_category == 0 ? 1 : $hamza_lite_category;
        $hamza_lite_display_thumbnail = $hamza_lite_instance['show_post_thumbnail'];
        $hamza_lite_post_date = $hamza_lite_instance['show_post_date'];
        $hamza_lite_recent_arg = array('post_type' => 'post', 'cat' => $hamza_lite_category, 'post_status' => 'publish', 'posts_per_page' => $hamza_lite_number_of_post);
        //var_dump($recent_arg);
        $hamza_lite_recent_qry = new WP_Query($hamza_lite_recent_arg);
        if ($hamza_lite_recent_qry->have_posts()) {
            echo $before_widget;
            // Check if title needs to be shown
            if (isset($hamza_lite_display_title)) {
                echo $before_title . $hamza_lite_display_title . $after_title;
            }
            while ($hamza_lite_recent_qry->have_posts()) {
                $hamza_lite_recent_qry->the_post();
                $hamza_lite_img_url = wp_get_attachment_image_src(get_post_thumbnail_id(), 'hamza-lite-recent-post-thumbnail', true);
                ?>
                <div class="hamza_lite-recent-rightdivs clearfix">
                <?php 
                if ($hamza_lite_display_thumbnail) {
                    if (has_post_thumbnail()) {
                        ?>
                            <div class="hamza_lite-recent-rightbar-img">
                                <a href="<?php 
                        the_permalink();
                        ?>
"><img src="<?php 
                        echo esc_url($hamza_lite_img_url[0]);
                        ?>
" alt="<?php 
                        the_title();
                        ?>
" /></a>
                            </div>    
                        <?php 
                    } else {
                        ?>
                            <div class="hamza_lite-recent-rightbar-img">
                                <a href="<?php 
                        the_permalink();
                        ?>
"><img src="<?php 
                        echo esc_url(get_template_directory_uri() . '/images/image65by56.jpg');
                        ?>
" alt="<?php 
                        the_title();
                        ?>
" /></a>
                            </div>
                        <?php 
                    }
                }
                ?>
                    <div class="hamza_lite-recent-rightbar-content">
                        <h6 class="hamza_lite-recent-rightbar-title"><a href="<?php 
                the_permalink();
                ?>
"><?php 
                echo hamza_lite_excerpt(get_the_title(), 30);
                ?>
</a></h6>
                        <?php 
                if ($hamza_lite_post_date) {
                    ?>
                            <div class="hamza_lite-recent-rightbar-date"><?php 
                    echo get_the_date('F j, Y');
                    ?>
</div>
                            <?php 
                }
                ?>
                    </div>
                </div>            
                <?php 
            }
            echo $after_widget;
            wp_reset_postdata();
        }
    }