first commit
This commit is contained in:
61
wp-content/themes/aac/inc/template-article-card.php
Normal file
61
wp-content/themes/aac/inc/template-article-card.php
Normal file
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
$image = $args['image'] ?? '';
|
||||
$title = $args['title'] ?? '';
|
||||
$link = $args['link'] ?? '#';
|
||||
$category = $args['category'] ?? '';
|
||||
|
||||
$post_id = $args['post_id'] ?? get_the_ID();
|
||||
|
||||
$author_id = get_post_field('post_author', $post_id);
|
||||
$author_name = get_the_author_meta('display_name', $author_id);
|
||||
$author_url = get_author_posts_url($author_id);
|
||||
$author_img = get_avatar_url($author_id, ['size' => 96]);
|
||||
$second_img = get_field('second_profile_img', 'user_' . $author_id);
|
||||
|
||||
$gender = get_field('plec', 'user_' . $author_id);
|
||||
$author_title = ($gender === 'female') ? 'Autorka' : 'Autor';
|
||||
if ($second_img && $gender === 'female') {
|
||||
$author_title = 'Autorki';
|
||||
}
|
||||
?>
|
||||
|
||||
<article class="article-card">
|
||||
<?php if ($category) : ?>
|
||||
<ol class="card-tags">
|
||||
<?php foreach ($category as $item) : ?>
|
||||
<li><span><?php echo $item->name; ?></span></li>
|
||||
<?php endforeach; ?>
|
||||
</ol>
|
||||
<?php endif; ?>
|
||||
<div class="card-img">
|
||||
<a href="<?php echo $link; ?>">
|
||||
<img src="<?php echo $image; ?>" alt="">
|
||||
</a>
|
||||
</div>
|
||||
<div class="card-data">
|
||||
<div class="card-title">
|
||||
<h3><a href="<?php echo $link; ?>"><?php echo $title; ?></a></h3>
|
||||
</div>
|
||||
|
||||
<div class="card-footer">
|
||||
<div class="card-author">
|
||||
<ol class="card-author--img">
|
||||
<li>
|
||||
<img src="<?php echo esc_url($author_img); ?>" alt="<?php echo esc_attr($author_name); ?>">
|
||||
</li>
|
||||
<?php if($second_img) : ?>
|
||||
<li>
|
||||
<img src="<?php echo esc_url($second_img); ?>" alt="<?php echo esc_attr($author_name); ?>">
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
</ol>
|
||||
<div class="card-author--data">
|
||||
<p class="card-author--title"><?php echo $author_title; ?></p>
|
||||
<a class="card-author--name" href="#"><?php echo esc_html($author_name); ?></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<a href="<?php echo $link; ?>" class="btn-2">Czytaj dalej</a>
|
||||
</div>
|
||||
</div>
|
||||
</article>
|
||||
Reference in New Issue
Block a user