Making WordPress.org

Changeset 6456


Ignore:
Timestamp:
01/29/2018 07:05:22 PM (7 years ago)
Author:
obenland
Message:

Showcase: Use built-in page navigation.

Removes the need for a plugin to provide a paginated navigation.

Location:
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-showcase
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-showcase/archive.php

    r6273 r6456  
    2929            <?php endwhile; // have_posts ?>
    3030
    31             <?php if ( 1 != $wp_query->max_num_pages || function_exists( 'wp_page_numbers' ) ) { wp_page_numbers(); } ?>
     31            <?php
     32                the_posts_pagination( [
     33                    'mid_size' => 2,
     34                ] );
     35            ?>
    3236
    3337        <?php else : // have_posts ?>
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-showcase/index.php

    r6273 r6456  
    77            breadcrumb();
    88            $num_posts = 400;
    9             if ( $paged > 1 ) $offset = "&offset=" . ($paged - 1) * $num_posts;
     9            $offset    = $paged > 1 ? "&offset=" . ($paged - 1) * $num_posts : '';
    1010            query_posts("showposts=" . $num_posts . "&post_type=post&post_status=publish" . $offset);
    1111        ?>
     
    1818
    1919            <?php endwhile; // have_posts ?>
    20             <?php if ( 1 != $wp_query->max_num_pages || function_exists( 'wp_page_numbers' ) ) { wp_page_numbers(); } ?>
     20            <?php
     21                the_posts_pagination( [
     22                    'current'  => $paged ?: 1,
     23                    'mid_size' => 2,
     24                ] );
     25            ?>
    2126
    2227        <?php else : // have_posts ?>
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-showcase/style.css

    r6273 r6456  
    341341}
    342342
    343 #wordpress-org #wp_page_numbers ul,
    344 #wordpress-org #wp_page_numbers li,
    345 #wordpress-org #wp_page_numbers a {
    346         padding: 0;
    347         margin: 0;
    348         text-decoration: none;
    349         font-style: normal;
    350         list-style: none;
    351         text-transform: none;
    352         text-indent: 0px;
    353         font-variant: normal;
    354         text-align: left;
    355         line-height: 14px;
    356         letter-spacing: 0px;
    357         word-spacing: 0px;
    358         font-size: 12px;
    359         font-family: sans-serif;
    360 }
    361 
    362 #wordpress-org #wp_page_numbers {
    363         margin: 10px 0 22px 0;
    364         width: 100%;
    365 }
    366 #wordpress-org #wp_page_numbers ul {
    367         width: 100%;
    368         padding-top: 10px;
    369 }
    370 #wordpress-org #wp_page_numbers li {
    371         float: left;
    372         display: block;
    373         margin-bottom: 2px;
    374 }
    375 #wordpress-org #wp_page_numbers li.page_info {
    376         padding: 2px 8px 3px 0;
    377 }
    378 #wordpress-org #wp_page_numbers a {
    379         padding: 3px;
    380         padding-left: 5px;
    381         padding-right: 5px;
    382         margin-left: 2px;
    383         margin-right: 2px;
    384         display: block;
    385         border: 1px solid #cccccc;
    386 }
    387 
    388 #wordpress-org #wp_page_numbers li a:hover {
    389         border-color: #999999;
    390 }
    391 
    392 #wordpress-org #wp_page_numbers li.space {
    393         padding: 6px;
    394         padding-left: 2px;
    395         padding-right: 2px;
    396 }
    397 
    398 #wordpress-org #wp_page_numbers li.active_page a {
    399         background-color:#328AB2;
    400         border:1px solid #328AB2;
    401     color:#FFFFFF;
    402 }
    403 
    404 #wordpress-org #wp_page_numbers li.active_page a:hover  {
    405         background-color:#328AB2;
    406         border:1px solid #328AB2;
    407         color:#FFFFFF;
     343.pagination {
     344    margin: 10px 0 22px 0;
     345}
     346
     347.pagination .nav-links {
     348    border-top: 1px solid #ccc;
     349    padding-top: 10px;
     350    text-align: center;
     351}
     352
     353.pagination .nav-links .page-numbers {
     354    border: 1px solid #ccc;
     355    display: inline-block;
     356    margin: 0 2px;
     357    padding: 3px 5px;
     358}
     359.pagination .nav-links .page-numbers.dots {
     360    border: none;
     361    padding: 3px;
     362}
     363
     364.pagination .nav-links a:hover {
     365    border-color: #999;
     366}
     367
     368.pagination .nav-links .current {
     369    background-color: #328ab2;
     370    border: 1px solid #328ab2;
     371    color: #fff;
     372}
     373
     374.pagination .nav-links .next,
     375.pagination .nav-links .prev {
     376    bottom: -9px;
     377    float: none;
     378    height: 20px;
     379    overflow: hidden;
     380    position: relative;
     381    width: 16px;
     382}
     383
     384.pagination .nav-links .next:before,
     385.pagination .nav-links .prev:before {
     386    -moz-osx-font-smoothing: grayscale;
     387    -webkit-font-smoothing: antialiased;
     388    display: inline-block;
     389    font-family: "Dashicons";
     390    font-size: 16px;
     391    line-height: 1;
     392    speak: none;
     393    text-align: center;
     394    text-decoration: inherit;
     395    text-transform: none;
     396    vertical-align: sub;
     397}
     398
     399.pagination .nav-links .next:before {
     400    content: "\f345";
     401}
     402
     403.pagination .nav-links .prev:before{
     404    content: "\f341";
    408405}
    409406
Note: See TracChangeset for help on using the changeset viewer.