php – Why my filterable portfolio page work not perfectly between slug button and slug output WORDRPESS?

I currently have a Portfolio custom page in WordPress, so far work as i want, but i have one problem. The problem is when i click one of the button slug then the body/output is not work like i want, for example in slug IOS there is 3 item, should when i click appear 3 item from IOS slug, but in this only appear 1 item.

I have read many tutorial similiar to this problem but can’t solved, please someone help me, I’ve been trying to solve this but still not working.

the following an article i have read: , How to create filterable portfolio in WordPress? and How to display the rest of categories on Portfolio filterable.

This is what I have so far:

<!-- Content
============================================= -->
<section id="content">

    <div class="content-wrap">

        <div class="container clearfix">

            <!-- Portfolio Filter
         ============================================= -->
            <ul id="portfolio-filter" class="portfolio-filter clearfix" data-container="#portfolio">

                <li class="activeFilter"><a href="#" data-filter="*">Show All</a></li>
                $terms = get_terms("workcategory");
                $count = count($terms);
                if ( $count > 0 ){
                    foreach ( $terms as $term ){
                        <li><a href="#" data-filter=".pf-<?php echo $term->slug ?>">
                                <?php echo $term->name." (".$term->count.")";?>
                    <?php } } ?>

            </ul><!-- #portfolio-filter end -->

            <div id="portfolio-shuffle" class="portfolio-shuffle" data-container="#portfolio">
                <i class="icon-random"></i>

            <div class="clear"></div>

            <!-- Portfolio Items
                ============================================= -->
            <div id="portfolio" class="portfolio grid-container portfolio-nomargin clearfix">

                $args = array('post_type' => 'ourworks',
                    'posts_per_page'=> -1,
                    'orderby'       => 'DESC');
                $query = new WP_Query($args);
                if( $query->have_posts() ) :
                    while ( $query->have_posts() ) : $query->the_post();
                        /* grab the url for the full size featured image */
                        $featured_img_url = get_the_post_thumbnail_url(get_the_ID(),'full');
                        $terms_ourworks = get_the_terms( $post->ID, 'workcategory');

                        <article class="portfolio-item pf-<?php echo $terms_ourworks(0)->slug; ?>">
                            <div class="portfolio-image">
                                add_filter( 'post_thumbnail_html', 'remove_width_attribute', 10 );
                                add_filter( 'image_send_to_editor', 'remove_width_attribute', 10 );
                                <div class="portfolio-overlay">
                                    <a href="<?php echo $featured_img_url; ?>" class="left-icon" data-lightbox="image"><i class="icon-line-plus"></i></a>
                                    <a href="<?php the_permalink(); ?>" class="right-icon"><i class="icon-line-ellipsis"></i></a>
                            <div class="portfolio-desc">
                                the_title( sprintf( '<h3 class="entry-title"><a href="%s" rel="bookmark">',
                                    esc_url( get_permalink() ) ), '</a></h3>' );
                           $categories_list = get_the_term_list( $post->ID, 'workcategory', '', ', ' );
                           if ( $categories_list ) {
                               /* translators: 1: list of categories. */
                               printf(esc_html__( '%1$s', 'afterclass' ), $categories_list );
                    <?php endwhile; endif; wp_reset_postdata(); ?>

            </div><!-- #portfolio end -->



</section><!-- #content end -->

Can somebody check my code?

This the current status:
enter image description here

The output of this in the source code is the following:

<article class="portfolio-item pf-<?php echo $terms_ourworks(0)->slug; ?>">