
	
<?php
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;

$args = array(
    'post_type'=>'post',
    'posts_per_page' => $title2 ? $title2 : 9,
    'paged' => $paged,
);

$loop = new WP_Query( $args );
if ( $loop->have_posts() ) {
    while ( $loop->have_posts() ) : $loop->the_post();
	
?>

<div class="product-list234234">
<div class="product-list-1234234">

<a class="rrf-eee" href="<?php the_permalink(); ?>">
	<?php the_post_thumbnail(''); ?>
<h3><?php the_title(); ?></h3>
</a>
<div class="list-dec">
<?php
$excerpt = get_the_excerpt();

$excerpt = substr($excerpt, 0, 160);
$result = substr($excerpt, 0, strrpos($excerpt, ' '));
echo $result;
?> </div>
<div class="list-meta">
<span class="list-meta-133334">
<?php
// Get author ID
$author_id = get_the_author_meta('ID');

// Get attachment ID
$avatar_attachment_id = get_user_meta($author_id, 'avatar', true);

// Get default avatar URL
$default_avatar_url = get_template_directory_uri() . '/img/user.jpg';

// Display author avatar
if ($avatar_attachment_id) {
  // Get image URL
  $avatar_url = wp_get_attachment_url($avatar_attachment_id);
  if ($avatar_url) {
    echo '<img src="' . esc_url($avatar_url) . '" alt="Author Avatar" width="100" height="100">';
  } else {
    // Display default avatar
    echo '<img src="' . esc_url($default_avatar_url) . '" alt="Default Avatar" width="100" height="100">';
  }
} else {
  // Display default avatar
  echo '<img src="' . esc_url($default_avatar_url) . '" alt="Default Avatar" width="100" height="100">';
}
?>
<h5><?php echo get_the_author_meta('display_name'); ?> </h5>

</span>
<span class="list-meta-2445435">
<?php the_time('d M Y'); ?>
</span>
</div>
</div></div>
		<?php
    endwhile;

    $total_pages = $loop->max_num_pages;

    if ($total_pages > 1){

        $current_page = max(1, get_query_var('paged'));
echo "		<div class='mik-999-1400'>
";
        echo paginate_links(array(
            'base' => get_pagenum_link(1) . '%_%',
            'format' => '/page/%#%',
            'current' => $current_page,
            'total' => $total_pages,
            'prev_text'    => __('قبلی'),
            'next_text'    => __('بعدی')
        ));
		echo "</div>";
    }    
}
wp_reset_postdata();
?>
