Add pledge sorting markup

This commit is contained in:
Kelly Dwan 2019-10-25 13:51:01 -04:00
parent 2ad4b5c1e0
commit 5d6cb25232
No known key found for this signature in database
GPG key ID: 8BA5575F3D11575D

View file

@ -2,6 +2,8 @@
namespace WordPressdotorg\Five_for_the_Future\Theme;
use const WordPressDotOrg\FiveForTheFuture\Pledge\CPT_ID;
// If we don't have any posts to display for the archive, then send a 404 status. See #meta4151.
if ( ! have_posts() ) {
status_header( 404 );
@ -15,10 +17,30 @@ get_header(); ?>
<?php if ( have_posts() ) : ?>
<header class="page-header">
<?php
the_archive_title( '<h1 class="page-title">', '</h1>' );
the_archive_description( '<div class="taxonomy-description">', '</div>' );
?>
<h1 class="page-title"><?php esc_html_e( 'Pledges', 'wordpressorg' ); ?></h1>
<a href="/for-organizations/" class="button"><?php esc_html_e( 'Pledge your company', 'wordpressorg' ); ?></a>
<div class="page-header-controls">
<form method="get" action="<?php echo esc_url( get_post_type_archive_link( CPT_ID ) ); ?>">
<label for="pledge-sort"><?php esc_html_e( 'Sort pledges by', 'wordpressorg' ); ?></label>
<select id="pledge-sort" name="order">
<option value="" <?php selected( $_GET['order'], '' ); ?>>
<?php esc_html_e( 'All Pledges', 'wordpressorg' ); ?>
</option>
<option value="alphabetical" <?php selected( $_GET['order'], 'alphabetical' ); ?>>
<?php esc_html_e( 'Alphabetical', 'wordpressorg' ); ?>
</option>
<option value="contributors" <?php selected( $_GET['order'], 'contributors' ); ?>>
<?php esc_html_e( 'Total Contributors', 'wordpressorg' ); ?>
</option>
</select>
<span class="screen-reader-text">
<input type="submit" />
</span>
</form>
<?php get_search_form(); ?>
</div>
</header><!-- .page-header -->
<?php