wp_back/wp-content/themes/simple-theme/author copy 3.php

60 lines
1.7 KiB
PHP
Raw Normal View History

2024-05-20 15:37:46 +03:00
<?php
// Set the Current Author Variable $curauth
$curauth = (isset($_GET['author_name'])) ? get_user_by('slug', $author_name) : get_userdata(intval($author));
get_header();
?>
<style>
.content-wrapper {
margin-top: 55px;
}
</style>
<div class="author-profile-card">
<h2>About: <?php echo $curauth->nickname; ?></h2>
<div class="author-photo">
<?php echo get_avatar( $curauth->user_email , '90 '); ?>
</div>
<p><strong>Website:</strong> <a href="<?php echo $curauth->user_url; ?>"><?php echo $curauth->user_url; ?></a><br />
<strong>Bio:</strong> <?php echo $curauth->user_description; ?></p>
</div>
<h2>Posts by <?php echo $curauth->nickname; ?>:</h2>
<?php
$publications = new WP_Query([
'post_type' => 'post',
'author' => $curauth->ID,
'posts_per_page' => 4,
'orderby' => 'date',
'order' => 'DESC',
'paged' => 1,
]);
?>
<?php if($publications->have_posts()): ?>
<div class="layout ppd-container column">
<div class="layout article-cards wrap" id="articles-container" style="flex-direction:column;">
<?php
while ($publications->have_posts()): $publications->the_post(); ?>
<div >
<h2><a href="<?php echo esc_url(the_permalink()); ?>"><?php the_title(); ?></a></h2>
</div> <?php
endwhile;
?>
</div>
</div>
<?php endif;
$paged = get_query_var('paged') ? get_query_var('paged') : 1;
$max_pages = $wp_query->max_num_pages;
if ($paged < $max_pages) {
echo '<div id="loadmore" style="text-align:center;">
<a href="#" data-max-pages="' . $max_pages . '" data-paged="' . $paged . '" class="btn btn-warning mt-3">Загрузить ещё</a>
';
}
wp_reset_query();
get_footer(); ?>