Example #1
0
 /**
  * Filters wp_title to print a neat <title> tag based on what is being viewed.
  *
  * @param string $title Default title text for current view.
  * @param string $sep Optional separator.
  * @return string The filtered title.
  */
 function jeweltheme_polmo_wp_title($title, $sep)
 {
     if (is_feed()) {
         return $title;
     }
     global $page, $paged;
     // Add the blog name.
     $title .= get_bloginfo('name', 'display');
     // Add the blog description for the home/front page.
     $site_description = get_bloginfo('description', 'display');
     if ($site_description && (is_home() || is_front_page())) {
         $title .= " {$sep} {$site_description}";
     }
     // Add a page number if necessary.
     if (($paged >= 2 || $page >= 2) && !is_404()) {
         $title .= " {$sep} " . sprintf(esc_htmlesc_html__('Page %s', 'polmo-lite'), max($paged, $page));
     }
     return $title;
 }
Example #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($args, $instance)
    {
        extract($args);
        $title = apply_filters('widget_title', empty($instance['title']) ? __('Recent Posts', 'polmo-lite') : $instance['title'], $instance, $this->id_base);
        $avatar_size = empty($instance['avatar_size']) ? 70 : $instance['avatar_size'];
        $word_limit = empty($instance['word_limit']) ? 20 : $instance['word_limit'];
        $count = empty($instance['count']) ? 2 : $instance['count'];
        echo $before_widget;
        echo $before_title . $title . $after_title;
        ?>

            <div class="widget widget_recent_post">
              <div class="widget-details">

                <?php 
        $rp = new WP_Query('order=DESC&posts_per_page=' . $count . '');
        if ($rp->have_posts()) {
            while ($rp->have_posts()) {
                $rp->the_post();
                ?>
                    
                    <article class="type-post post">
                      <div class="post-thumbnail pull-left">

                        <?php 
                if (has_post_thumbnail()) {
                    $url = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()), array(70, 70));
                    ?>
                            <img class="img-circle" src="<?php 
                    echo esc_url($url[0]);
                    ?>
" alt="<?php 
                    the_title();
                    ?>
" />
                        <?php 
                }
                ?>
                      </div><!-- /.post-thumbnail -->
                      <div class="post-content">
                        <h5 class="entry-title"><a href="<?php 
                the_permalink();
                ?>
"><?php 
                the_title();
                ?>
</a></h5>
                        <div class="post-meta">
                          <div class="entry-date">
                            <time datetime="<?php 
                echo get_the_time('Y-m-j');
                ?>
">
                                <?php 
                echo get_the_time('M');
                ?>
 <?php 
                echo get_the_time('y');
                ?>
                            </time>
                          </div><!-- /.entry-date -->
                          <div class="comments">
                            <span class="comments-icon"><i class="fa fa-comments"></i></span>
                            <span class="count"><?php 
                echo get_comments_number();
                ?>
</span> <?php 
                echo esc_htmlesc_html__("comments", "polmo-lite");
                ?>
                          </div><!-- /.comments -->
                        </div><!-- /.post-meta -->
                      </div><!-- /.post-content -->
                    </article>

                <?php 
            }
            wp_reset_postdata();
        }
        ?>

              </div><!-- /.widget-details -->
            </div><!-- /.widget -->


            <?php 
        // $output = ob_get_clean();
        // return $output;
        echo $after_widget;
    }