| Linux webm007.cluster106.gra.hosting.ovh.net 5.15.167-ovh-vps-grsec-zfs-classid #1 SMP Tue Sep 17 08:14:20 UTC 2024 x86_64 Path : /home/e/g/l/eglisebaa/www/wp-content/themes/hallelujah/ |
| Current File : /home/e/g/l/eglisebaa/www/wp-content/themes/hallelujah/single.php |
<?php
/**
* The template to display single post
*
* @package WordPress
* @subpackage HALLELUJAH
* @since HALLELUJAH 1.0
*/
// Full post loading
$full_post_loading = hallelujah_get_value_gp( 'action' ) == 'full_post_loading';
// Prev post loading
$prev_post_loading = hallelujah_get_value_gp( 'action' ) == 'prev_post_loading';
// Position of the related posts
$hallelujah_related_position = hallelujah_get_theme_option( 'related_position' );
// Type of the prev/next posts navigation
$hallelujah_posts_navigation = hallelujah_get_theme_option( 'posts_navigation' );
$hallelujah_prev_post = false;
// Rewrite style of the single post if current post loading via AJAX and featured image and title is not in the content
if ( ( $full_post_loading || $prev_post_loading ) && ! in_array( hallelujah_get_theme_option( 'single_style' ), array( 'in-above', 'in-below', 'in-over', 'in-sticky' ) ) ) {
hallelujah_storage_set_array( 'options_meta', 'single_style', 'in-below' );
}
get_header();
while ( have_posts() ) {
the_post();
// Type of the prev/next posts navigation
if ( 'scroll' == $hallelujah_posts_navigation ) {
$hallelujah_prev_post = get_previous_post( true ); // Get post from same category
if ( ! $hallelujah_prev_post ) {
$hallelujah_prev_post = get_previous_post( false ); // Get post from any category
if ( ! $hallelujah_prev_post ) {
$hallelujah_posts_navigation = 'links';
}
}
}
// Override some theme options to display featured image, title and post meta in the dynamic loaded posts
if ( $full_post_loading || ( $prev_post_loading && $hallelujah_prev_post ) ) {
hallelujah_sc_layouts_showed( 'featured', false );
hallelujah_sc_layouts_showed( 'title', false );
hallelujah_sc_layouts_showed( 'postmeta', false );
}
// If related posts should be inside the content
if ( strpos( $hallelujah_related_position, 'inside' ) === 0 ) {
ob_start();
}
// Display post's content
get_template_part( apply_filters( 'hallelujah_filter_get_template_part', 'content', 'single-' . hallelujah_get_theme_option( 'single_style' ) ), 'single-' . hallelujah_get_theme_option( 'single_style' ) );
// If related posts should be inside the content
if ( strpos( $hallelujah_related_position, 'inside' ) === 0 ) {
$hallelujah_content = ob_get_contents();
ob_end_clean();
ob_start();
do_action( 'hallelujah_action_related_posts' );
$hallelujah_related_content = ob_get_contents();
ob_end_clean();
$hallelujah_related_position_inside = max( 0, min( 9, hallelujah_get_theme_option( 'related_position_inside' ) ) );
if ( 0 == $hallelujah_related_position_inside ) {
$hallelujah_related_position_inside = mt_rand( 1, 9 );
}
$hallelujah_p_number = 0;
$hallelujah_related_inserted = false;
for ( $i = 0; $i < strlen( $hallelujah_content ) - 3; $i++ ) {
if ( '<' == $hallelujah_content[ $i ] && 'p' == $hallelujah_content[ $i + 1 ] && in_array( $hallelujah_content[ $i + 2 ], array( '>', ' ' ) ) ) {
$hallelujah_p_number++;
if ( $hallelujah_related_position_inside == $hallelujah_p_number ) {
$hallelujah_related_inserted = true;
$hallelujah_content = ( $i > 0 ? substr( $hallelujah_content, 0, $i ) : '' )
. $hallelujah_related_content
. substr( $hallelujah_content, $i );
}
}
}
if ( ! $hallelujah_related_inserted ) {
$hallelujah_content .= $hallelujah_related_content;
}
hallelujah_show_layout( $hallelujah_content );
}
// Author bio
if ( hallelujah_get_theme_option( 'show_author_info' ) == 1
&& ! is_attachment()
&& get_the_author_meta( 'description' )
&& ( 'scroll' != $hallelujah_posts_navigation || hallelujah_get_theme_option( 'posts_navigation_scroll_hide_author' ) == 0 )
&& ( ! $full_post_loading || hallelujah_get_theme_option( 'open_full_post_hide_author' ) == 0 )
) {
do_action( 'hallelujah_action_before_post_author' );
get_template_part( apply_filters( 'hallelujah_filter_get_template_part', 'templates/author-bio' ) );
do_action( 'hallelujah_action_after_post_author' );
}
// Previous/next post navigation.
if ( 'links' == $hallelujah_posts_navigation && ! $full_post_loading ) {
do_action( 'hallelujah_action_before_post_navigation' );
?>
<div class="nav-links-single<?php
if ( ! hallelujah_is_off( hallelujah_get_theme_option( 'posts_navigation_fixed' ) ) ) {
echo ' nav-links-fixed fixed';
}
?>">
<?php
the_post_navigation(
array(
'next_text' => '<span class="nav-arrow"></span>'
. '<span class="screen-reader-text">' . esc_html__( 'Next post:', 'hallelujah' ) . '</span> '
. '<h6 class="post-title">%title</h6>'
. '<span class="post_date">%date</span>',
'prev_text' => '<span class="nav-arrow"></span>'
. '<span class="screen-reader-text">' . esc_html__( 'Previous post:', 'hallelujah' ) . '</span> '
. '<h6 class="post-title">%title</h6>'
. '<span class="post_date">%date</span>',
)
);
?>
</div>
<?php
do_action( 'hallelujah_action_after_post_navigation' );
}
// Related posts
if ( 'below_content' == $hallelujah_related_position
&& ( 'scroll' != $hallelujah_posts_navigation || hallelujah_get_theme_option( 'posts_navigation_scroll_hide_related' ) == 0 )
&& ( ! $full_post_loading || hallelujah_get_theme_option( 'open_full_post_hide_related' ) == 0 )
) {
do_action( 'hallelujah_action_related_posts' );
}
// If comments are open or we have at least one comment, load up the comment template.
$hallelujah_comments_number = get_comments_number();
if ( comments_open() || $hallelujah_comments_number > 0 ) {
if ( hallelujah_get_value_gp( 'show_comments' ) == 1 || ( ! $full_post_loading && ( 'scroll' != $hallelujah_posts_navigation || hallelujah_get_theme_option( 'posts_navigation_scroll_hide_comments' ) == 0 || hallelujah_check_url( '#comment' ) ) ) ) {
do_action( 'hallelujah_action_before_comments' );
comments_template();
do_action( 'hallelujah_action_after_comments' );
} else {
?>
<div class="show_comments_single">
<a href="<?php echo esc_url( add_query_arg( array( 'show_comments' => 1 ), get_comments_link() ) ); ?>" class="theme_button show_comments_button">
<?php
if ( $hallelujah_comments_number > 0 ) {
echo esc_html( sprintf( _n( 'Show comment', 'Show comments ( %d )', $hallelujah_comments_number, 'hallelujah' ), $hallelujah_comments_number ) );
} else {
esc_html_e( 'Leave a comment', 'hallelujah' );
}
?>
</a>
</div>
<?php
}
}
if ( 'scroll' == $hallelujah_posts_navigation && ! $full_post_loading ) {
?>
<div class="nav-links-single-scroll"
data-post-id="<?php echo esc_attr( get_the_ID( $hallelujah_prev_post ) ); ?>"
data-post-link="<?php echo esc_attr( get_permalink( $hallelujah_prev_post ) ); ?>"
data-post-title="<?php the_title_attribute( array( 'post' => $hallelujah_prev_post ) ); ?>">
</div>
<?php
}
}
get_footer();