= 1 && intval( $columns ) <= 5 ) ? intval( $columns ) : 4; // Create a custom WP Query $count = intval( $count ); $query_args = array(); $query_args['posts_per_page'] = ( empty( $count ) ) ? 7 : $count; if ( $category ) $query_args['category'] = $category; $query_args['meta_query'] = array( array( 'key' => '_thumbnail_id', 'compare' => 'EXISTS' ), ); $query_args = apply_filters( 'maghoot_post_grid_query', $query_args, $instance, $before_title, $title, $after_title ); $post_grid_query = get_posts( $query_args ); // Temporarily remove read more links from excerpts maghoot_remove_readmore_link(); // Add Pagination if ( !function_exists( 'maghoot_post_grid_pagination' ) ) : function maghoot_post_grid_pagination( $post_grid_query, $query_args ) { global $hybridext_currentwidget; if ( !empty( $hybridext_currentwidget['instance'] ) ) extract( $hybridext_currentwidget['instance'], EXTR_SKIP ); if ( !empty( $viewall ) ) { $base_url = ( !empty( $query_args['category'] ) ) ? esc_url( get_category_link( $query_args['category'] ) ) : ( ( get_option( 'page_for_posts' ) ) ? esc_url( get_permalink( get_option( 'page_for_posts' ) ) ) : esc_url( home_url('/') ) ); $class = sanitize_html_class( 'view-all-' . $viewall ); if ( $viewall == 'top' ) $class .= ( !empty( $title ) ) ? ' view-all-withtitle' : ''; echo '
'; } } endif; if ( $viewall == 'top' ) { add_action( 'maghoot_post_grid_start', 'maghoot_post_grid_pagination', 10, 2 ); remove_action( 'maghoot_post_grid_end', 'maghoot_post_grid_pagination', 10, 2 ); } elseif ( $viewall == 'bottom' ) { add_action( 'maghoot_post_grid_end', 'maghoot_post_grid_pagination', 10, 2 ); remove_action( 'maghoot_post_grid_start', 'maghoot_post_grid_pagination', 10, 2 ); } else { remove_action( 'maghoot_post_grid_start', 'maghoot_post_grid_pagination', 10, 2 ); remove_action( 'maghoot_post_grid_end', 'maghoot_post_grid_pagination', 10, 2 ); } // Template modification Hook do_action( 'maghoot_post_grid_wrap', $post_grid_query, $query_args ); ?>