= 1 && intval( $columns ) <= 3 ) ? intval( $columns ) : 1; // Create a custom WP Query $posts_per_page = 0; for ( $ci = 1; $ci <= 3; $ci++ ) { ${ 'count' . $ci } = intval( ${ 'count' . $ci } ); ${ 'count' . $ci } = empty( ${ 'count' . $ci } ) ? 3 : ${ 'count' . $ci }; if ( $ci <= $columns ) $posts_per_page += ${ 'count' . $ci }; } $query_args = array(); $query_args['posts_per_page'] = $posts_per_page; if ( $category ) $query_args['category'] = $category; if ( $offset ) $query_args['offset'] = $offset; $query_args = apply_filters( 'maghoot_posts_list_query', $query_args, $instance, $before_title, $title, $after_title ); $posts_list_query = get_posts( $query_args ); // Temporarily remove read more links from excerpts if ( apply_filters( 'maghoot_posts_list_remove_readmore', true ) ) maghoot_remove_readmore_link(); // Add Pagination if ( !function_exists( 'maghoot_posts_list_pagination' ) ) : function maghoot_posts_list_pagination( $posts_list_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( $category ) || !empty( $title ) ) ? ' view-all-withtitle' : ''; echo '
'; } } endif; if ( $viewall == 'top' ) { add_action( 'maghoot_posts_list_start', 'maghoot_posts_list_pagination', 10, 2 ); remove_action( 'maghoot_posts_list_end', 'maghoot_posts_list_pagination', 10, 2 ); } elseif ( $viewall == 'bottom' ) { add_action( 'maghoot_posts_list_end', 'maghoot_posts_list_pagination', 10, 2 ); remove_action( 'maghoot_posts_list_start', 'maghoot_posts_list_pagination', 10, 2 ); } else { remove_action( 'maghoot_posts_list_start', 'maghoot_posts_list_pagination', 10, 2 ); remove_action( 'maghoot_posts_list_end', 'maghoot_posts_list_pagination', 10, 2 ); } // Template modification Hook do_action( 'maghoot_posts_list_wrap', $posts_list_query, $query_args ); ?>