Bad theme code – can you find the error?

OK, I’m just going to list things out as I go through. Some of what follows is stylistic feedback, some is security related, some is functional:

<div class="home-featured-block"> 
    <?php
        $featured_block=$profitmag_settings['featured_block_one'];
        $no_of_block=$profitmag_settings['no_of_block_one'];                    

I don’t know what the $profitmag_settings variable looks like, but either of these parameters could be unset. Instead of just assuming they exist, you need to provide a default. For example, $featured_block = isset( $profitmag_settings['featured_block_one'] ? $profitmag_settigs['featured_block_one'] : 'default';.

        $query1=new WP_Query( 'cat=".$featured_block."&posts_per_page=".$no_of_block );

Seeing that these values are being passed into a query bothers me. String concatenation is only OK if you”re sanitizing values before passing them along. So instead of just a straight-up concatentation, I’d wrap in sanitization functions. For example: … '&posts_per_page=" . absint( $no_of_block ) );

        if( $query1->have_posts() ):
            $cat_name = get_cat_name( $featured_block );                       
    ?>
           <h2 class="block-title"><span class="bordertitle-red"></span><?php echo $cat_name; ?></h2>

Before using $cat_name, you need to first make sure it exists (what if no category exists with the specified ID?). You also need to, again, sanitize things before outputting on the page: <?php echo esc_html( $cat_name ); ?>.

            <div class="feature-post-wrap clearfix">
            <?php
            $count = 0;
            while( $query1->have_posts() ):
                $query1->the_post();
                $count++; ?>
                <div class="featured-post clearfix">
                    <figure class="post-thumb clearfix">
                        <?php
                        if( has_post_thumbnail() ):
                            $post_thumb = wp_get_attachment_image_src( get_post_thumbnail_id(), "three-col-thumb' );
                        ?>
                            <a href="https://wordpress.stackexchange.com/questions/182061/<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" ><img src="<?php echo $post_thumb[0]; ?>" alt="<?php the_title_attribute(); ?>" title="<?php the_title_attribute(); ?>" /></a>

Again, you need to be escaping things before echoing to the page. echo esc_url( get_the_permalink() ) is preferred over just the_permalink() for security purposes, for example. And you need to verify that the $post_thumb returned is actually what you expected before you use it, following by escaping the output as you print it.

                        <?php endif; ?>
                    </figure>
                    <div class="post-desc clearfix">
                        <h3 class="feature-main-title"><a href="https://wordpress.stackexchange.com/questions/182061/<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" ><?php the_title(); ?></a></h3>
                        <div class="post-date feature-main-date"><i class="fa fa-calendar"></i><?php echo get_the_date( 'F d, Y') ; ?></div>
                    </div>
                </div>
                <?php
                if($count % 3 == 0) echo "<div class="clear"></div>";
            endwhile;
        endif;
        wp_reset_postdata(); ?>
    </div>
</div>

The only other feedback I can provide is a question: If this isn’t doing what you expect it to, then what is it doing. On the surface, the code itself looks functionally correct. The only other things that could be an issue is how you’re setting up your categories and using them to identify $featured_block. I’d check first of all to see if $query1 is returning what you expect. If so, then there’s nothing in the code that follows to prevent this from functioning as you described in your question.

If $query1 is returning something unexpected, then I’d start there by rebuilding the query.