fictioneer/partials/_post.php

70 lines
2.3 KiB
PHP
Raw Normal View History

2023-01-21 01:31:34 +01:00
<?php
/**
* Partial: Post
*
* Renders a list of full-width posts paginated using the "Blog pages show at most"
* (posts_per_page) option under Settings > Reading.
*
* @package WordPress
* @subpackage Fictioneer
* @since 2.0
* @see partials/_loop.php
2023-03-10 15:35:55 +01:00
*
* @internal $args['nested'] Whether the post is nested inside another query. Default null.
* @internal $args['context'] Render context of the partial ('loop' or 'shortcode_fictioneer_blog').
2023-01-21 01:31:34 +01:00
*/
// No direct access!
defined( 'ABSPATH' ) OR exit;
2023-01-21 01:31:34 +01:00
// Setup
$post_id = get_the_ID();
$title = fictioneer_get_safe_title( $post_id, 'post' );
$label = esc_attr( sprintf( _x( 'Continue reading %s', 'Read more link aria label', 'fictioneer' ), $title ) );
2023-01-21 01:31:34 +01:00
if (
! get_option( 'fictioneer_show_full_post_content' ) &&
! strpos( $post->post_content, '<!--more-->' )
) {
2024-02-28 16:19:26 +01:00
$content = '<p>' . fictioneer_get_excerpt() . '</p><div class="more-link-wrapper"><a class="more-link" href="' . get_permalink() . '" title="' . $label . '" aria-label="' . $label . '">' . fcntr( 'read_more' ) . '</a></div>';
} else {
$content = apply_filters( 'the_content', get_the_content( fcntr( 'read_more' ) ) );
2023-01-21 01:31:34 +01:00
}
?>
2024-08-12 02:42:45 +02:00
<article id="post-<?php echo $post_id; ?>" class="post">
2023-01-21 01:31:34 +01:00
<?php do_action( 'fictioneer_post_article_open', $post_id, $args ); ?>
2023-01-21 01:31:34 +01:00
<header class="post__header">
<?php
$header_items = array(
'title' => '<h2 class="post__title h1"><a href="' . get_the_permalink() . '">' . $title . '</a></h2>',
'meta' => '<div class="post__meta layout-links">' . fictioneer_get_post_meta_items() . '</div>'
);
$header_items = apply_filters( 'fictioneer_filter_post_header_items', $header_items, $post_id, $args );
echo implode( '', $header_items );
?>
2023-01-21 01:31:34 +01:00
</header>
<section class="post__main content-section"><?php echo $content; ?></section>
<?php do_action( 'fictioneer_post_after_content', $post_id, $args ); ?>
<?php if ( has_action( 'fictioneer_post_footer_left' ) || has_action( 'fictioneer_post_footer_right' ) ) : ?>
2023-01-21 01:31:34 +01:00
<footer class="post__footer">
2023-08-30 13:51:49 +02:00
<div class="post__footer-box post__footer-left">
<?php do_action( 'fictioneer_post_footer_left', $post_id, $args ); ?>
2023-01-21 01:31:34 +01:00
</div>
2023-08-30 13:51:49 +02:00
<div class="post__footer-box post__footer-right">
<?php do_action( 'fictioneer_post_footer_right', $post_id, $args ); ?>
2023-01-21 01:31:34 +01:00
</div>
</footer>
<?php endif; ?>
</article>