Get the Category ID for this page
<? php Get_header (); // get the Category ID for this page $cat _title false); // Name of this page category $cats $cat _title, ' Cat_media '); // get classification objects by name $cat= $cats->term_id; // get the category ID based on the classification object ?>
Articles that output this category
//Custom classification is the same as the default classification, also directly with have_posts (), do not need to query or the like
<ul> <?PHP$num= 0; The 3rd right of each row has a different style while(Have_posts ()) {the_post (); $url= Get_field ("Post_vedio_url",get_the_id ()); AFC custom field (get video address based on article ID)if(!$url){ $url= Get_field ("Post_img",get_the_id ()); If the video address is empty, assign a picture address}if($num%3==0){ Echo' <article class= ' Hd_web_con ' > '; If the modulo is 0, start the tag}?> <divclass= "hd_web_c_l" > <a target= "_blank" href= "<?php Echo$url;?> "> "> </a> </div> <?PHPif($num%3==2){ Echo' </article> '; If modulo is 2, end tag}$num++;}?> </ul>
Output all categories under its parent class
<!--output the respective definition categories under the parent class---> <ulclass= "List" ><?PHP$args=Array( "Hide_empty" =>0,//empty also display"By" = "ID",//Sort by ID"Taxonomy" = "Cat_media"//Custom category name (Must have) ); $categories= Get_categories ($args);//get a collection of categories based on the args parameter foreach($categories as $obj) { ?> <liclass= "<?php if ($cat==$obj->cat_id) echo "Thistab",?> "> <a href=" <?php Echo Get_category_link ($obj->cat_id)?> "> <?phpEcho $obj->cat_name; ?> </a> </li><?php
}
?></ul>
dddd
E: List page for "Picture video" (taxonomy-cat_media.php)