A section of the PHP code that shows the entire category wants to change to show a specific category.

Source: Internet
Author: User
A section of the PHP code that shows all the classifications wants to change to show specific categories.
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 is the current code. There is a table in my database that has a field that is term_id I have the term_id of the categories that need to be displayed $duqu inside I want to ask how to insert this variable into the above code can only show those selected term_id classification it?

Share to:


------Solution--------------------
while ($DUQUSHUJUKUWP _terms=mysql_fetch_array ($SHAIXUANKUWP _terms)) {$duqu _slug[]= $duqushujukuwp _terms[slug];}

$duqu _slug is an array of rows you don't want to display.
  • Related Article

    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.