Changeset 2530086
- Timestamp:
- 05/12/2021 12:59:07 AM (5 years ago)
- Location:
- connected-sermons/trunk
- Files:
-
- 5 edited
-
Includes/shortcode-functions.php (modified) (1 diff)
-
Includes/template-functions.php (modified) (1 diff)
-
connected-sermons.php (modified) (1 diff)
-
readme.txt (modified) (2 diffs)
-
views/partials/list-view.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
connected-sermons/trunk/Includes/shortcode-functions.php
r2517230 r2530086 49 49 * @since NEXT 50 50 */ 51 public function sermons_list( )51 public function sermons_list( $args ) 52 52 { 53 $page_size = absint( sanitize_text_field( $args['num_sermons'] ) ); 54 if ( 0 === $page_size ) { 55 $page_size = 10; 56 } 57 set_query_var( 'page_size', $page_size ); 53 58 ob_start(); 54 59 cacs_get_part( 'list-view' ); -
connected-sermons/trunk/Includes/template-functions.php
r2517230 r2530086 242 242 return \ChurchAgency\ConnectedSermons\cs_fs()->is_not_paying();; 243 243 } 244 245 /** 246 * Whether There is Old Content based on page location. 247 * 248 * @author Scott Anderson <[email protected]> 249 * @since 1.0.5 250 * @param int $page_number Current Page Number 251 * @param int $page_size Page Size of Content. 252 * @param int $total_count Total Number of Content. 253 * @return bool 254 */ 255 function cacs_older_content(int $page_number, int $page_size, int $total_count): bool 256 { 257 $total_pages = cacs_total_pages($page_size, $total_count); 258 259 if ($total_count == 0 || $page_number >= $total_pages) { 260 return false; 261 } 262 263 return true; 264 } 265 266 /** 267 * Whether There is Newer Content based on page location. 268 * 269 * @author Scott Anderson <[email protected]> 270 * @since 1.0.5 271 * @param int $page_number Current Page Number 272 * @param int $page_size Page Size of Content. 273 * @param int $total_count Total Number of Content. 274 * @return bool 275 */ 276 function cacs_newer_content(int $page_number, int $page_size, int $total_count): bool 277 { 278 $total_pages = cacs_total_pages($page_size, $total_count); 279 280 if ($total_count == 0 || $page_number == 0 || $page_number > $total_pages) { 281 return false; 282 } 283 284 return true; 285 } 286 287 /** 288 * Returns how many total pages exist for a given content type. 289 * 290 * @author Scott Anderson <[email protected]> 291 * @since 1.0.5 292 * @param int $page_size Page Size of Content. 293 * @param int $total_count Total Number of Content. 294 * @return bool 295 */ 296 function cacs_total_pages(int $page_size, int $total_count): int 297 { 298 return absint(ceil($total_count / $page_size)) - 1; 299 } -
connected-sermons/trunk/connected-sermons.php
r2517230 r2530086 5 5 * Plugin URI: https://church.agency/connected-sermons/ 6 6 * Description: Easily add audio and video sermons to your church's website. 7 * Version: 1.0. 47 * Version: 1.0.5 8 8 * Author: Church Agency 9 9 * Author URI: https://church.agency/ -
connected-sermons/trunk/readme.txt
r2520094 r2530086 1 1 === Connected Sermons === 2 Contributors: oceas 2 Contributors: oceas, freemius 3 3 Tags: sermons, series, books, bible, preacher, church 4 4 Requires at least: 5.6.0 … … 78 78 ## Changelog ## 79 79 80 ### 1.0.5 - May 11, 2021 ### 81 * New: Added pagination support to sermons list. 82 80 83 ### 1.0.4 - April 10th, 2021 ### 81 84 * New: Main admin page with documentation links. -
connected-sermons/trunk/views/partials/list-view.php
r2517230 r2530086 8 8 * @package church 9 9 */ 10 11 if (isset($_GET['cs_page'])) { 12 $page_num = sanitize_text_field($_GET['cs_page']); 13 } else { 14 $page_num = 0; 15 } 16 17 $total_count = absint(wp_count_posts('cs_sermons')->publish); 18 $offset = $page_num * $page_size; 10 19 11 20 $preachers = get_terms([ … … 32 41 $args = [ 33 42 'post_type' => 'cs_sermons', 34 'numberposts' => -1,43 'numberposts' => $page_size, 35 44 'tax_query' => [ 36 45 [ … … 43 52 'meta_key' => 'cs_date', 44 53 'order' => 'DES', 54 'offset' => $offset, 45 55 ]; 46 56 } else { 47 57 $args = [ 48 58 'post_type' => 'cs_sermons', 49 'numberposts' => -1,59 'numberposts' => $page_size, 50 60 'orderby' => 'meta_value', 51 61 'meta_key' => 'cs_date', 52 62 'order' => 'DES', 63 'offset' => $offset, 53 64 ]; 54 65 } … … 111 122 </div> 112 123 124 <?php if (-1 != $page_size) : ?> 125 <div class="row"> 126 <div class="col"> 127 <?php if (cacs_newer_content($page_num, $page_size, $total_count)) : ?> 128 <a class="btn btn-outline-primary" href="?cs_page=<?php echo $page_num - 1; ?>"> <?php echo __('Newer Sermons', 'connected_sermons') ?> </a> 129 <?php endif; ?> 130 131 </div> 132 <div class="col text-right"> 133 <?php if (cacs_older_content($page_num, $page_size, $total_count)) : ?> 134 <a class="btn btn-outline-primary" href="?cs_page=<?php echo $page_num + 1; ?>"> <?php echo __('Previous Sermons', 'connected_sermons') ?> </a> 135 <?php endif; ?> 136 </div> 137 </div> 138 <?php endif; ?> 139 113 140 </main><!-- #main -->
Note: See TracChangeset
for help on using the changeset viewer.