Hello! Using the code below, I list the subcategories in the category specified in id_cat.
<?php if(isset($_GET['id_cat'])){ $res = mysql_query("SELECT TER.`term_id`, TER.`name` FROM `wp_terms` TER LEFT JOIN `wp_term_taxonomy` TAX ON TER.`term_id` = TAX.`term_id` WHERE TAX.`parent`='".abs(intval($_GET['id_cat']))."'"); if(mysql_num_rows($res)>0){ while($row = mysql_fetch_assoc($res)){ echo "<li><a href='firmlist.php?id_subcat={$row['term_id']}'>{$row['name']}</a></li>"; } }else{ echo 'Error!'; } }else{ echo 'Error!'; } ?>
Tell me plz how to make it so that, in addition to the list of subcategories, you can display in the header the name of the category to which the displayed list of subcategories belongs? The category id is contained in id_cat, you need to extract the name parameter from the wp_terms table by the given id.