Uname: Linux webm012.cluster130.gra.hosting.ovh.net 5.15.167-ovh-vps-grsec-zfs-classid #1 SMP Tue Sep 17 08:14:20 UTC 2024 x86_64
Software: Apache
PHP version: 8.0.30 [ PHP INFO ] PHP os: Linux
Server Ip: 145.239.37.162
Your Ip: 216.73.216.190
User: dreampi (1009562) | Group: users (100)
Safe Mode: OFF
Disable Function:
_dyuweyrj4,_dyuweyrj4r,dl

name : recent-post.php
<?php

class Motiox_WP_Widget_Recent_Posts extends WP_Widget_Recent_Posts {
    public function widget($args, $instance) {
        if (!isset($args['widget_id'])) {
            $args['widget_id'] = $this->id;
        }

        $title = (!empty($instance['title'])) ? $instance['title'] : esc_html__('Recent Posts', 'motiox');

        /** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */
        $title = apply_filters('widget_title', $title, $instance, $this->id_base);

        $number = (!empty($instance['number'])) ? absint($instance['number']) : 5;
        if (!$number) {
            $number = 5;
        }
        $show_date = isset($instance['show_date']) ? $instance['show_date'] : false;

        /**
         * Filters the arguments for the Recent Posts widget.
         *
         * @param array $args An array of arguments used to retrieve the recent posts.
         * @param array $instance Array of settings for the current widget.
         * @see WP_Query::get_posts()
         *
         * @since 3.4.0
         * @since 4.9.0 Added the `$instance` parameter.
         *
         */
        $r = new WP_Query(
            apply_filters(
                'widget_posts_args',
                array(
                    'posts_per_page'      => $number,
                    'no_found_rows'       => true,
                    'post_status'         => 'publish',
                    'ignore_sticky_posts' => true,
                ),
                $instance
            )
        );

        if (!$r->have_posts()) {
            return;
        }
        ?>
        <?php echo sprintf('%s', $args['before_widget']); ?>
        <?php
        if ($title) {
            echo sprintf('%s', $args['before_title'] . $title . $args['after_title']);
        }
        ?>
        <ul class="recent-posts">
            <?php foreach ($r->posts as $recent_post) : ?>
                <?php
                $post_title = get_the_title($recent_post->ID);
                $title      = (!empty($post_title)) ? $post_title : esc_html__('(no title)', 'motiox');
                $author_id = $recent_post->post_author;
                ?>
                <li>
                    <div class="recent-posts-thumbnail">
                        <a href="<?php the_permalink($recent_post->ID); ?>">
                            <?php echo get_the_post_thumbnail($recent_post->ID, 'thumbnail') ?>
                        </a>
                    </div>
                    <div class="recent-posts-info">
                        <?php if ($show_date) : ?>
                            <a class="post-date" href="<?php the_permalink($recent_post->ID); ?>" data-hover="<?php echo get_the_date('d M Y', $recent_post->ID); ?>">
                                <span><?php echo get_the_date('d M Y', $recent_post->ID); ?></span>
                            </a>
                        <?php endif; ?>
                        <h4 class="entry-title">
                            <a href="<?php the_permalink($recent_post->ID); ?>"<?php if (get_queried_object_id() === $recent_post->ID) {
                                echo ' aria-current="page"';
                            } ?>><?php echo sprintf('%s', $title); ?></a>
                        </h4>
                    </div>

                </li>
            <?php endforeach; ?>
        </ul>
        <?php
        echo sprintf('%s', $args['after_widget']); // WPCS: XSS ok.
    }
}
© 2026 GrazzMean-Shell