# userswp/1.2.16/templates/loop-posts.php

UsersWP – Front-end login form, User Registration, User Profile &amp; Members Directory plugin for WP, version 1.2.16. 31 lines.

- Page: https://pluginprobe.com/plugins/userswp/1.2.16/code/templates/loop-posts.php
- Raw: https://pluginprobe.com/plugins/userswp/1.2.16/raw/templates/loop-posts.php
- Modified: 2024-03-13T13:47:28+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/userswp/1.2.16/code/templates/loop-posts.php#L10-L20`.

```php
<?php

if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly
}

$the_query = isset( $args['template_args']['the_query'] ) ? $args['template_args']['the_query'] : '';
$title = isset( $args['template_args']['title'] ) ? $args['template_args']['title'] : '';
?>
<h3><?php echo esc_html( $title ); ?></h3>
<div class="uwp-profile-item-block">
	<?php
	// The Loop
	if ($the_query && $the_query->have_posts()) {

		echo '<ul class="uwp-profile-item-ul">';
		while ($the_query->have_posts()) {
			$the_query->the_post();
			uwp_get_template('posts-post.php', $args);
		}
		echo '</ul>';

		/* Restore original Post Data */
		wp_reset_postdata();
	} else {
		// no posts found
		echo "<p>" . esc_html( sprintf( __( "No %s found.", 'userswp' ), $title ) )."</p>";
	}
	do_action('uwp_profile_pagination', $the_query->max_num_pages);
	?>
</div>
```
