E: List page for "Picture video" (taxonomy-cat_media.php)

Source: Internet
Author: User

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" &GT;&LT;?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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.