i need to have a tab with gategory post

i have a custom type named gallerie i need to create a tab with category in each category show ther post . i have this code but didn't work for me '''

section
div class=container
div class=row
?php
$gallery_cats = get_terms('gallery-category');
//nav
echo'nav div class=nav nav-tabs id=nav-tab role=tablist'; 
foreach($gallery_cats as $gallery_cat) {    
    echo'button class=nav-link  data-bs-toggle=tab data-bs-target='.$gallery_cat-slug.' type=button role=tab aria-controls='.$gallery_cat-slug.' aria-selected=true'.$gallery_cat-name.'/button';
}
echo'/div/nav';
//content   
        query_posts(array(
        'post_type' = 'gallery',
        'gallery-category' = $gallery_category,
        'posts_per_page' = 3,
    ));     
        if(have_posts()) {      
            echo'div class=tab-content id=nav-tabContent data-sort-id=gallery
            div class=tab-pane id=nav-home role=tabpanel aria-labelledby=nav-home-tab';   
                while (have_posts()) : the_post();  
            echo'
            div class=
            h4'.get_the_title($gallery_cat-ID).'/h4                     
         /div ';   
        endwhile;
            echo'/div/div';         
     }
    else { echo'pno post/p';}   
?
/div
/div
script src=https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js/script
script
          jQuery(document).ready(function($){
             jQuery(.nav-tabs button.nav-link:first).addClass(active);
             jQuery(.tab-content .tab-pane:first).addClass(show active);
             $(.nav-tabs button).click(function () {
                $(button).removeClass(active);
                $(this).addClass(active);   
                var tabactive=$(this).attr(data-bs-target);
                $(.tab-content .tab-pane).removeClass(show active);
                var a=$(# + tabactive );
                a.addClass(show active);
            });
          }); 
/script
/section

''' this is the result the tab didnt work and the post shows all posts

ANNT HELP PLEASE

Topic link-category post-thumbnails posts custom-post-types Wordpress

Category Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.