Hello world!

11/2023
đź•’ 1 min

Welcome to WordPress. This is your first post. Edit or delete it, then start writing!

Share with:
Related posts
More about Uncategorized
<?php

// Get the current post's categories
$post_categories = get_the_category();

// Find the parent category of the current post's categories
$parent_category = null;
foreach ($post_categories as $category) {
    if ($category->parent == 0) {
        $parent_category = $category;
        break;
    }
}

// Get the children categories of the parent category
if ($parent_category) {
    $args = array(
        'parent' => $parent_category->term_id, // Get children categories of the parent category
        'hide_empty' => 0,                     // Get categories even if they have no posts
    );

    $children_categories = get_categories($args);

    // Prepare an array to hold the children category IDs
    $children_category_ids = array();

    // Loop through each child category and add its ID to the children array
    foreach ($children_categories as $child_category) {
        $children_category_ids[] = $child_category->term_id;
    }

    add_filter('bricks/terms/query_vars', function ($query_vars, $settings, $element_id) use ($children_category_ids) {
        // Get only the children categories of the current post's parent category
        if ($element_id == 'jnniub') {
            $query_vars['include'] = $children_category_ids;
        }
    
        return $query_vars;
    }, 10, 3);
}

?>
Welcome to Waymore Silencers, in order to browse our site you must be at least 18 years of age.
Are you at least 18 years old?
No
Your Cart