0
我AA定制循环进入我的WordPress定制的博客页面,和Im显示我的所有帖子进去,这样的:动态的标签职位分类到WordPress的循环
<section class="container blog-article-actu">
<div class="row">
<?php
$the_query = new WP_Query('showposts=-1');
while ($the_query->have_posts()) :
$the_query->the_post();
$catObj = get_the_category();
?>
<article class="blog-article-actu-article" style="background:url('<?php $url = wp_get_attachment_url(get_post_thumbnail_id($post->ID), 'thumbnail'); ?><?php echo $url ?>');">
<div class="blog-article-actu-article-top">
<h2><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2>
<div class="details-blog-article-actu">
<div class="blog-article-actu-date">
<span class="day"><?php the_time('d') ?></span><br>
<span class="month"><?php the_time('F') ?></span>
</div>
<a href="#" target="_blank"><p>
<?php
if (($catObj[0]->name == 'Actualités et évènements') OR ($catObj[1]->name == 'Actualités et évènements')) {
echo "<img src=\"XXX/actu-icon.png\" alt=\"Actualités et évènements\">";
} elseif (($catObj[0]->name == 'Témoignages') OR ($catObj[1]->name == 'Témoignages')) {
echo "<img src=\"XXX/chat-icon.png\" alt=\"Témoignages\">";
} elseif (($catObj[0]->name == 'Vidéos') OR ($catObj[1]->name == 'Vidéos')) {
echo "<img src=\"XXX/video-icon.png\" alt=\"Vidéos\">";
} else {
echo "";
}
?>
</p></a>
</div>
</div>
<div class="blog-article-actu-article-bottom-wrap">
<span class="blog-article-actu-article-excerpt"><?php the_excerpt();?></span>
<span class="blog-article-actu-article-bottom"><a href="<?php the_permalink() ?>">En savoir <span>+</span></a></span>
<div class="social-blog-article-actu">
<a href="#" target="_blank"><i class="fa fa-twitter" aria-hidden="true"></i></a>
<a href="http://www.facebook.com/sharer.php?u=<?php the_permalink() ?>&t=<?php the_title(); ?>"><i class="fa fa-facebook" aria-hidden="true"></i></a>
</div>
</div>
</article>
<?php // End of the loop.
endwhile;
?>
</div>
</section>
然后我被要求建立的东西对它们进行排序,通过标签,动态的,有类似这样的标记系统,这一个:https://codepen.io/Chaaampy/pen/gWOrvp
但是我有点失落有关......我想到得到我的环路中的每个帖子的标签,然后将其添加为一个CSS类,就像我可以显示或隐藏JS中的一些文章......呃,我不知道,有人对我有什么想法吗?
谢谢! :)