add files
This commit is contained in:
42
content-popular-blog.php
Normal file
42
content-popular-blog.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<div class="partners">
|
||||
<div class="partners__header">
|
||||
Самое читаемое
|
||||
</div>
|
||||
<div class="row">
|
||||
<?php
|
||||
$category = get_the_category()[0];
|
||||
query_posts(
|
||||
[
|
||||
"cat" => $category->term_id,
|
||||
"posts_per_page" => 3,
|
||||
"post_type" => ["profile_article"],
|
||||
"post__not_in" => [ get_the_ID() ]
|
||||
]
|
||||
);
|
||||
while (have_posts()){
|
||||
the_post();
|
||||
?>
|
||||
<div class="col-12 col-md-4" data-id="<?= get_the_ID(); ?>">
|
||||
<a class="partners__item d-flex d-lg-block" href="<?= get_the_permalink(); ?>?utm_from=must-main">
|
||||
<span class="partners__frame">
|
||||
<?php if(has_post_thumbnail()): ?>
|
||||
<?php if(wp_is_mobile()): ?>
|
||||
<img loading="lazy" class="lazyload" src="https://cdn.profile.ru/wp-content/themes/profile/assets/img/Profile_lazyload_m.webp" data-src="<?= wp_get_attachment_image_src( get_post_thumbnail_id(), 'thumbnail' )[0]; ?>" alt="<?= get_secondary_title(); ?>">
|
||||
<?php else: ?>
|
||||
<img loading="lazy" class="lazyload" src="https://cdn.profile.ru/wp-content/themes/profile/assets/img/Profile_lazyload.jpg" data-src="<?= wp_get_attachment_image_src( get_post_thumbnail_id(), 'medium' )[0]; ?>" alt="<?= get_secondary_title(); ?>">
|
||||
<?php endif; ?>
|
||||
<?php else: ?>
|
||||
<img loading="lazy" <?php if(wp_is_mobile()): ?>src="https://cdn.profile.ru/wp-content/themes/profile/assets/img/Profile_lazyload_m.webp"<?php else: ?>src="https://cdn.profile.ru/wp-content/themes/profile/assets/img/Profile_lazyload.jpg"<?php endif; ?> alt="<?= get_secondary_title(); ?>">
|
||||
<?php endif; ?>
|
||||
</span>
|
||||
<strong class="partners__item__title">
|
||||
<?= get_secondary_title(); ?>
|
||||
</strong>
|
||||
</a>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
wp_reset_query();
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user