我需要在我的主页中显示一些类别,并显示类别图像,以及相同的链接。使用WORDPRESS。
对于他们坚持同样风格的例子不是问题。我出现了困难,也就是说,问题在于调用类别及其属性的代码,如:图像,链接和标题。 Example
这是我正在尝试做的事情:
<section id=""
class="projects">
<div class="js-projects-gallery">
<div class="projects_block row">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php
$args = array(
'show_option_all' => '',
'echo' => 1,
'hide_empty' => 0,
'style' => 'list',
'title_li' => __('Categorias')
);
?>
<div class="project project_item col-sm-6 col-md-4 col-lg-3">
<?php foreach (get_categories($args) as $cat) : ?>
<a class="link" href="<?php echo get_category_link($cat->term_id); ?>"
title="<?php echo $cat->cat_name; ?>">
<figure>
<img src="<?php echo z_taxonomy_image_url($cat->term_id); ?>"
class="size-goarch-image-480x880-croped">
<figcaption>
<h3 class="project-title">
<?php echo $cat->cat_name; ?>
</h3>
<h4 class="project-category">
<?php echo $cat->cat_name; ?>
</h4>
<div class="project-zoom"></div>
</figcaption>
</figure>
</a>
<?php endforeach; ?>
</div>
<?php endwhile; else: ?>
<div class="project project_item col-sm-6 col-md-4 col-lg-3">
<p><?php echo "Sorry, we have nothing posted yet."; ?></p>
</div>
<?php endif; ?>
</div>
</div>
</section>