File: /var/www/html/wp-content/themes/polygant_2023/author.php
<?php
/**
* The template for displaying author pages
*
*/
?>
<?php get_header('new'); ?>
<?php
// Set the Current Author Variable
$cur_auth = (isset($_GET['author_name'])) ? get_user_by('slug', $author_name) : get_userdata(intval($author));
$user_id = $cur_auth->ID;
$acf_id = 'user_'.$user_id;
// get current lang - wpml_current_language()
$current_lang = apply_filters('wpml_current_language', NULL);
if ($current_lang === 'en') {
$page_title = get_field( "aut_page_title", $acf_id );
$page_content = get_field( "aut_content", $acf_id );
$posts_list_title = 'Last publications';
} elseif ($current_lang === 'ru') {
$page_title = get_field( "aut_page_title_rus", $acf_id );
$page_content = get_field( "aut_content_rus", $acf_id );
$posts_list_title = 'Последние публикации';
echo '<style>.archive.author .pl-post-author.hero .pl-bio .pl-left .title, .archive.author .pl-post-author.hero .pl-bio .pl-left .info, .archive.author .pl-post-author.hero .pl-bio .pl-left .info p, .archive.author .pl-post-author.hero .pl-bio .pl-left .info span, .archive.author .pl-post-author.hero .pl-bio .pl-left .info a, .archive.author .pl-post-author.hero .pl-bio .pl-left .info b, .archive.author .pl-post-author.hero .pl-bio .pl-left .list-posts h2, .archive.author .pl-post-author.hero .pl-bio ul.publications-list li a { font-family: "Montserrat", sans-serif!important; }</style>';
}
$page_image_url = get_field( "aut_image", $acf_id );
$my_home_url = apply_filters( 'wpml_home_url', get_option( 'home' ) );
?>
<section class="pl-post-author hero">
<div class="container">
<div class="pl-bio">
<div class="pl-left">
<h1 class="title"><?php echo $page_title; ?></h1>
<div class="bread">
<p id="breadcrumbs">
<span>
<span><a href="<?php echo $my_home_url; ?>" ><?php the_field('главная_название', apply_filters( 'wpml_object_id', 233, 'page' ) );?></a></span> — <span class="breadcrumb_last" aria-current="page"><?php echo $page_title; ?></span>
</span>
</p>
</div>
<div class="pl-right mobile">
<img src="<?php echo $page_image_url; ?>">
</div>
<div class="info">
<?php echo $page_content; ?>
</div>
<div class="list-posts">
<h2><?php echo $posts_list_title; ?></h2>
<?php
$args = array(
'post_type' => array('post', 'cases', 'blog'),
'post_status' => 'publish',
'author' => $user_id,
'posts_per_page' => 18,
'orderby' => 'date',
'order' => 'DESC'
);
$query_posts = new WP_Query($args);
?>
<?php if ( $query_posts->have_posts() ) {
?><ul class="publications-list"><?php
while ( $query_posts->have_posts() ) {
$query_posts->the_post(); ?>
<li>
<a href="<?php the_permalink() ?>" title="<?php the_title(); ?>">
<?php the_title(); ?></a>
</li>
<?php }
?></ul><?php
}
wp_reset_postdata();
?>
</div>
</div>
<div class="pl-right de">
<img src="<?php echo $page_image_url; ?>">
</div>
</div>
</div>
</section>
<?php
get_footer('new');