PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Sunday, January 30, 2022

[FIXED] How to show wordpress parent catgorie page show subcategories list

 January 30, 2022     categories, wordpress     No comments   

Issue

It's possible parent categories show subcategories list (name,image,description)

Example

Parent Category:

  • Subcategory name 1.1(Title)
    Subcategory image
    Subcategory description

  • Subcategory name 1.2(Title)
    Subcategory image
    Subcategory description

Thanks


Solution

I have solved this. Please find the code given below,

<?php $this_category = get_category($cat); ?>   

<ul class="product_list">
    <?php
    $id = get_query_var('cat');
    $args = array(  'parent' => $id );
    foreach (get_categories($args) as $cat) : ?>

    <li>
        <a href="<?php echo get_category_link($cat->term_id); ?>"><img src="<?php echo z_taxonomy_image_url($cat->term_id); ?>" /></a>
        <a href="<?php echo get_category_link($cat->term_id); ?>"><?php echo $cat->cat_name; ?></a>
        <p><?php echo $cat->description; ?></p>

    </li>

    <?php endforeach; ?>
</ul>

Thanks,
Vino



Answered By - vino
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing