HEX
Server: Apache/2.4.41 (Ubuntu)
System: Linux wordpress-ubuntu-s-2vcpu-4gb-fra1-01 5.4.0-169-generic #187-Ubuntu SMP Thu Nov 23 14:52:28 UTC 2023 x86_64
User: root (0)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/shoetique/wp-content/themes/north-wp/inc/widgets/latest-posts-images.php
<?php
// thb latest Posts w/ Images
class widget_latestimages extends WP_Widget {
	function __construct() {
		$widget_ops = array(
			'classname'   => 'widget_latestimages',
			'description' => __('Display latest posts with images','north')
		);
	
		parent::__construct(
			'thb_latestimages_widget',
			__( 'Fuel Themes - Latest Posts with Images' , 'north' ),
			$widget_ops
		);
				
		$this->defaults = array( 'title' => 'Latest Posts', 'show' => '3' );
	}

	public function widget($args, $instance) {
		extract($args);
		$title = apply_filters('widget_title', $instance['title']);
		$show = $instance['show'];
		global $post, $wpdb;
		$themePath = THB_THEME_ROOT;
		$pop = new WP_Query();
		$pop->query('showposts='.$show.'');
		
		echo $before_widget;
		echo $before_title;
		echo $title;
		echo $after_title;
		echo '<ul>';
		while  ($pop->have_posts()) : $pop->the_post(); ?>
		<li>
		   <figure>
		 <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>">
		 <?php if ( has_post_thumbnail() ) {
		 		the_post_thumbnail();
		 } else { ?>
		 		<img src="<?php echo THB_THEME_ROOT; ?>/assets/img/nothumb.jpg" alt="No Post Image for <?php the_title(); ?>" width="40" height="40" />
		 <?php } ?>
		 </a>
		 </figure>
		 <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>" class="postlink"><?php the_title(); ?></a>
		</li>
		<?php endwhile;
		echo '</ul>';
		echo $after_widget;
		
		wp_reset_query();
	}
	public function update( $new_instance, $old_instance ) {
		$instance = $old_instance;
		
		/* Strip tags (if needed) and update the widget settings. */
		$instance['title'] = $new_instance['title'];
		$instance['show'] = $new_instance['show'];
		
		return $instance;
	}
	public function form($instance) {
	       
		$defaults = $this->defaults;
		$instance = wp_parse_args( (array) $instance, $defaults ); ?>
		
		<p>
		       <label for="<?php echo $this->get_field_id( 'title' ); ?>">Widget Title:</label>
		       <input id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo $instance['title']; ?>" style="width:100%;" />
		</p>
		
		<p>
		       <label for="<?php echo $this->get_field_id( 'name' ); ?>">Number of Posts:</label>
		       <input id="<?php echo $this->get_field_id( 'name' ); ?>" name="<?php echo $this->get_field_name( 'show' ); ?>" value="<?php echo $instance['show']; ?>" style="width:100%;" />
		</p>
		<?php
	}
}
function widget_latestimages_init()
{
       register_widget('widget_latestimages');
}
add_action('widgets_init', 'widget_latestimages_init');

?>