wp_back/wp-content/themes/simple-theme/author.php
2024-05-20 15:37:46 +03:00

172 lines
7.3 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
//author.php
get_header(author);
if(is_author()){
$author_id = get_the_author_meta('ID');
$author_name = get_the_author_meta('display_name');
$author_description = get_the_author_meta('description', $author_id);
$user_nicename = get_the_author_meta('user_nicename');
$author_avatar = get_avatar_url( $author_id, array(
'size' => 450,
'default'=>'mystery',
));
}
$telegram = get_the_author_meta( 'tumblr', $post->post_author );
$facebook = get_the_author_meta( 'facebook', $post->post_author );
$vk = get_the_author_meta( 'linkedin', $post->post_author );
$instagram = get_the_author_meta( 'instagram', $post->post_author );
$odnoklassniki = get_the_author_meta( 'myspace', $post->post_author );
$author_bio__links_list = '';
$tag_list = get_field('tag_list', 'options');
if(!empty($telegram)) {
$author_bio__links_list .='
<a href="'. $telegram .'" target="_blank" rel="nofollow" style="text-decoration: none;">
<img height="20" src="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjIiIGhlaWdodD0iMTgiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTIxLjkzNyAxLjYzOWwtMy4zMiAxNS4yNzRjLS4yNSAxLjA3OC0uOTAzIDEuMzQ3LTEuODMxLjgzOWwtNS4wNTktMy42MzctMi40NCAyLjI5Yy0uMjcuMjY0LS40OTcuNDg0LTEuMDE3LjQ4NGwuMzYzLTUuMDI2IDkuMzc1LTguMjY1Yy40MDgtLjM1NC0uMDg4LS41NS0uNjMzLS4xOTZsLTExLjU5IDcuMTItNC45OS0xLjUyNEMtLjI5MSA4LjY2OC0uMzEgNy45NCAxLjAyIDcuNDMxTDIwLjUzOC4wOTZjLjkwMy0uMzMgMS42OTQuMTk2IDEuNCAxLjU0M3oiIGZpbGw9IiM3MjQ1RkYiIGZpbGwtcnVsZT0ibm9uemVybyIvPjwvc3ZnPg==" alt="telegram">
</a>
';
}
if(!empty($facebook)) {
$author_bio__links_list .='
<a href="'. $facebook .'" rel="nofollow" target="_blank" style="text-decoration: none;">
<img height="20" src="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTgiIGhlaWdodD0iMTgiIHZpZXdCb3g9IjAgMCAxOCAxOCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4NCjxwYXRoIGQ9Ik0xOCAyLjk4NDQ1QzE4IDEuMzk4OTYgMTYuNjAxIDAgMTUuMDE1NSAwSDIuOTg0NDVDMS4zOTg5NiAwIDAgMS4zOTg5NiAwIDIuOTg0NDVWMTUuMDE1NUMwIDE2LjYwMSAxLjM5ODk2IDE4IDIuOTg0NDUgMThIOS4wNDY2M1YxMS4xOTE3SDYuODA4MjlWOC4yMDcyNkg5LjA0NjYzVjYuOTk0ODJDOS4wNDY2MyA0Ljk0MyAxMC41Mzg5IDMuMTcwOTggMTIuNDA0MSAzLjE3MDk4SDE0LjgyOVY2LjE1NTQzSDEyLjQwNDFDMTIuMTI0NCA2LjE1NTQzIDExLjg0NDYgNi40MzUyMyAxMS44NDQ2IDYuOTk0ODJWOC4yMDcyNkgxNC44MjlWMTEuMTkxN0gxMS44NDQ2VjE4SDE1LjAxNTVDMTYuNjAxIDE4IDE4IDE2LjYwMSAxOCAxNS4wMTU1VjIuOTg0NDVaIiBmaWxsPSIjNzI0NUZGIi8+DQo8L3N2Zz4NCg==" alt="facebook">
</a>
';
}
if(!empty($vk)) {
$author_bio__links_list .='
<a href="'. $vk .'" rel="nofollow" target="_blank" style="text-decoration: none;">
<img width="25" src="/_nuxt/img/vk.384e0ec.svg" alt="vk">
</a>
';
}
if(!empty($instagram)) {
$author_bio__links_list .='
<a href="'. $instagram .'" rel="nofollow" target="_blank" style="text-decoration: none;">
<img width="18" src="/_nuxt/img/instagramm.16d5f97.svg" alt="instagramm">
</a>
';
}
if(!empty($odnoklassniki)) {
$author_bio__links_list .='
<a href="'. $odnoklassniki .'" rel="nofollow" target="_blank" style="text-decoration: none;">
<img width="11" src="/_nuxt/img/ok.3c137f5.svg" alt="ok"></a>
';
}
?>
<div class="author-bio_container ppd-container layout">
<div class="author-bio__img">
<img src="<?php echo $author_avatar; ?>" />
</div>
<div class="author-bio__txt">
<span class="author-bio__name-label">Автор</span>
<h1 class="author-bio__name"><?php echo $author_name; ?></h1>
<p class="author-bio__description"><?php echo $author_description; ?></p>
<?php
if(!empty($author_bio__links_list) ) {
echo '
<div class="author-bio__links">
<p>Соц.сети автора:</p>
<div class="author-bio__links-list">
'.$author_bio__links_list.'
</div>
</div>
';
}
?>
</div>
</div>
<div class="layout ppd-container align-start column_mobile">
<div class="layout blog-tags wrap">
<a class="tag-item all_tag" href="<?=str_replace("\"", "", "https://pampadu.ru/blog");?>/">
<div id="all" class="blog-tag <?php if(!is_tag()):?>active<?php endif;?>">Все</div>
</a>
<?php
if (!empty($tag_list)) : ?>
<?php foreach ($tag_list as $term) : ?>
<a class="tag-item <?= $term->slug . '__tag'?> <?php if(is_tag($term->slug)):?>tag-item__active<?php endif;?>" tabindex="0" href="<?=str_replace("\"", "", "https://pampadu.ru/blog");?>/tag/<?= $term->slug ?>/">
<div id="<?= $term->slug ?>" class="blog-tag <?php if(is_tag($term->slug)):?>active<?php endif;?>"><?= $term->name ?></div>
</a>
<?php endforeach; ?>
<?php endif;
?>
<button class="tag-item show-all_tag">
<span>Ещё</span>
<svg xmlns="http://www.w3.org/2000/svg" width="10" height="6" viewBox="0 0 10 6" fill="none">
<path d="M5 4.18934L8.78064 0.21967C9.05958 -0.0732236 9.51184 -0.0732236 9.79079 0.21967C10.0697 0.512563 10.0697 0.987437 9.79079 1.28033L5.50508 5.78033C5.22613 6.07322 4.77387 6.07322 4.49492 5.78033L0.209209 1.28033C-0.0697365 0.987437 -0.0697365 0.512563 0.209209 0.21967C0.488155 -0.0732236 0.940416 -0.0732236 1.21936 0.21967L5 4.18934Z" fill="#7D8D93"/>
</svg>
</button>
</div>
<div class="layout column align-end links-container" style="min-width: 284px;">
<div class="layout align-center" style="min-width: 284px; height: 36px; margin-left: 12px;">
<div style="font-weight: 500; font-size: 17px; margin-right: 12px;">Мы в соц.сетях</div>
<?php if (have_rows('social_links', 'option')) : ?>
<?php while (have_rows('social_links', 'option')) : the_row(); ?>
<a href="<?= get_sub_field('social_link'); ?>" target="_blank" style="width: 26px; height: 26px; margin: 0px 2px;"><img src="<?= get_sub_field('social_icon')['url'] ?>" style="width: 26px; height: 26px;" alt="logo"></a>
<?php endwhile; ?>
<?php endif; ?>
</div>
</div>
</div>
<div class="layout ppd-container column">
<div class="layout article-cards wrap author-articles" id="articles-container" data-title="<?php echo $author_name; ?>, автор блога Pampadu">
<?php
// 1 значение по умолчанию
$current_page = !empty( $_GET['page'] ) ? $_GET['page'] : 1;
$the_query = new WP_Query( array(
'posts_per_page' => 12,
'paged' => $current_page,
'author' => $author_id,
) );
if ($the_query) {
$posts_counter = 0;
// цикл вывода полученных записей
while( $the_query->have_posts() ){
$the_query->the_post();
echo get_template_part('blog-posts/blog-post-small');
if($posts_counter==3){
echo get_template_part('blog-posts/blog-banner', get_post_type(), array(
'banner_heading' => 'Зарегистрируйтесь и бесплатно оцените все возможности заработка на финансовых и страховых офферах',
'paragraph_text' => false,
));
}
$posts_counter++;
}
wp_reset_postdata();
}
// пагинация для произвольного запроса
echo '<div class="pagination-container d-n">';
echo paginate_links( array(
'base' => site_url() .'/author/' . $user_nicename. '/'. '%_%',
'format' => '?page=%#%',
'total' => $the_query->max_num_pages,
'current' => $current_page,
) );
echo '</div>';
?>
</div>
</div>
<?php
get_footer();
?>