Wordpress中的类别列表

时间:2015-11-16 10:47:01

标签: php wordpress

我正在尝试根据附图列出类别,但没有取得任何成功,如果有人有任何想法,请帮助我。南,东和北将循环,所以我可以随时添加任何其他,我是php或Wordpress的新手,所以需要你的帮助enter image description here

 <?php $args = array('orderby' => 'id', 'hide_empty'=> 0, 'child_of' => 1); $categories = get_categories($args); foreach ($categories as $cat) { $background_color = get_option('cat_background_color'.$cat->term_id); ?>
    <div class="col-lg-5 col-md-5 col-sm-5 col-xs-12 boxshadow categorylisting padd0 Box1">
  <div class="Catheading cat1" style="background-color: #<?php echo  $background_color; ?>;"> <span class="config"><img src="<?php echo z_taxonomy_image_url($cat->term_id); ?>" alt="" /></span>
    <h3><?php echo $cat->name ?></h3>
  </div>
    <div class="catlist">
    <ul>
      <?php   $args2= array("orderby"=>'id', "category" => $cat->cat_ID); // Get Post from each Sub-Category
    $posts_in_category = get_posts($args2);
    foreach($posts_in_category as $current_post) {

        ?>
      <li type='none' ><a href="<?=$current_post->guid;?>">
        <?=''.$current_post->post_title;?>
        </a></li>
      <?php
    } ?>
    </ul>
  </div>
</div>
<?php   } ?>

0 个答案:

没有答案