A section of php code that shows all one Categories. I want to change it to show specific categories. thank you!
Source: Internet
Author: User
A section of php code that shows all categories. if you want to change it to display a specific category, ask for help. thanks add_filter (& nbsp; 'Get _ terms ', & nbsp; 'Get _ subcategory_terms ', & nbsp; 10, & nbsp; 3 & nbsp;
Add_filter ('Get _ terms ', 'get _ subcategory_terms', 10, 3 );
Function get_subcategory_terms ($ terms, $ taxonomies, $ args ){
$ New_terms = array ();
If (in_array ('product _ cat', $ taxonomies )&&! Is_admin () & is_shop ()){
Foreach ($ terms as $ key => $ term ){
$ New_terms [] = $ term;
}
$ Terms = $ new_terms;
}
Return $ terms;
}
This section is the current code. in my database, there is a table with a field term_id. I have saved the term_id of the category to be displayed in $ duqu. I want to ask how to insert this variable to it. only the selected term_id categories can be displayed in the code. thank you for sharing the following:
------ Solution --------------------
While ($ duqushujukuwp_terms = mysql_fetch_array ($ shaixuankuwp_terms) {$ duqu_slug [] = $ duqushujukuwp_terms [slug];}
$ Duqu_slug is the array of rows you do not want to display.
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