}
    }
    $buffy .= '</ul>';
    $buffy .= '<div class="clearfix"></div>';
    $buffy .= '</div>';
}
//get the `filter_by` URL ($_GET) variable
$filter_by = get_query_var('filter_by');
$td_category_big_grid_drop_down_filter_options = array(array('id' => 'latest', 'value' => $category_link, 'caption' => __td('Latest')), array('id' => 'featured', 'value' => add_query_arg('filter_by', 'featured', $category_link), 'caption' => __td('Featured posts')), array('id' => 'popular', 'value' => add_query_arg('filter_by', 'popular', $category_link), 'caption' => __td('Most popular')), array('id' => 'popular7', 'value' => add_query_arg('filter_by', 'popular7', $category_link), 'caption' => __td('7 days popular')), array('id' => 'review_high', 'value' => add_query_arg('filter_by', 'review_high', $category_link), 'caption' => __td('By review score')), array('id' => 'random_posts', 'value' => add_query_arg('filter_by', 'random_posts', $category_link), 'caption' => __td('Random')));
// is a flag to hide the 'No posts to display' message if on category page there are between 1 and 5  posts
$global_flag_to_hide_no_post_to_display = '';
//this flag is checked in the loop.php file to hide the `No posts to display` message if we have the big grid on the page and there are between 1 and 5  posts
$global_flag_to_hide_no_post_to_display = $wp_query->post_count;
//if there are post to display add also the drop down category filter
if ($td_disable_big_grid != 'yes') {
    echo $buffy;
    //create the drop-down filter on category pages
    echo td_util::generate_category_pull_down($td_category_big_grid_drop_down_filter_options, $filter_by);
    //print_r($global_flag_to_hide_no_post_to_display);
    //only show the big grid on first page
    if ($paged < 2) {
        //parameters to filter to for big grid
        $atts_for_big_grid = array('limit' => '5', 'category_id' => $cur_cat_id);
        //add the sorting option to the big_grid
        if (!empty($filter_by)) {
            $atts_for_big_grid['sort'] = $filter_by;
        }
        //show the big grid
        echo td_global_blocks::get_instance('td_block_big_grid')->render($atts_for_big_grid);
    }
}