mirror of
https://github.com/WordPress/five-for-the-future.git
synced 2025-07-02 01:01:18 +03:00
Theme: Create template part for single pledge
This commit is contained in:
parent
59713ca0f1
commit
3d9207d9cd
|
@ -1,7 +1,8 @@
|
|||
<?php
|
||||
|
||||
namespace WordPressDotOrg\FiveForTheFuture\Theme;
|
||||
|
||||
$post_type = get_post_type(); // 5ftf_pledge
|
||||
|
||||
get_header(); ?>
|
||||
|
||||
<main id="main" class="site-main" role="main">
|
||||
|
@ -9,7 +10,7 @@ get_header(); ?>
|
|||
<?php while ( have_posts() ) :
|
||||
the_post();
|
||||
|
||||
get_template_part( 'template-parts/plugin', 'single' );
|
||||
get_template_part( 'template-parts/' . $post_type, 'single' );
|
||||
endwhile; ?>
|
||||
|
||||
</main><!-- #main -->
|
||||
|
|
60
themes/wporg-5ftf/template-parts/5ftf_pledge-single.php
Normal file
60
themes/wporg-5ftf/template-parts/5ftf_pledge-single.php
Normal file
|
@ -0,0 +1,60 @@
|
|||
<?php
|
||||
namespace WordPressDotOrg\FiveForTheFuture\Theme;
|
||||
|
||||
use WordPressDotOrg\FiveForTheFuture\Contributor;
|
||||
use WP_Post;
|
||||
|
||||
/** @var WP_Post $post */
|
||||
?>
|
||||
|
||||
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
|
||||
<header class="entry-header">
|
||||
<?php the_title( '<h2 class="entry-title">', '</h2>' ); ?>
|
||||
<span>
|
||||
<?php
|
||||
printf(
|
||||
'<a href="%1$s">%1$s</a>',
|
||||
esc_url( $post->{'5ftf_org-url'} )
|
||||
);
|
||||
?>
|
||||
</span>
|
||||
<!-- TODO logo -->
|
||||
</header>
|
||||
|
||||
<div class="entry-content">
|
||||
<h3><?php esc_html_e( 'About', 'wporg' ); ?></h3>
|
||||
|
||||
<?php echo wp_kses_post( wpautop( $post->{'5ftf_org-description'} ) ) ?>
|
||||
|
||||
<h3><?php esc_html_e( 'Contributions', 'wporg' ); ?></h3>
|
||||
|
||||
<!-- TODO Pull info from xprofile -->
|
||||
|
||||
<h3><?php esc_html_e( 'Contributors', 'wporg' ); ?></h3>
|
||||
|
||||
<ul class="contributor-grid">
|
||||
<?php foreach ( Contributor\get_pledge_contributors( get_the_ID(), 'publish' ) as $contributor_post ) :
|
||||
$contributor = get_user_by( 'login', $contributor_post->post_title );
|
||||
?>
|
||||
<li>
|
||||
<?php echo get_avatar( $contributor->user_email, 280 ); ?>
|
||||
<?php
|
||||
printf(
|
||||
'<a href="%1$s">%2$s</a>',
|
||||
sprintf(
|
||||
'https://profiles.wordpress.org/%s/',
|
||||
sanitize_key( $contributor->user_login )
|
||||
),
|
||||
esc_html( $contributor->display_name )
|
||||
);
|
||||
?>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<footer class="entry-footer">
|
||||
<!-- TODO Determine URL for reporting a pledge -->
|
||||
<a href="#"><?php esc_html_e( 'Report a problem', 'wporg' ); ?></a>
|
||||
</footer>
|
||||
</article>
|
Loading…
Reference in a new issue