<?php
/**
* Article Elements functions
*
* @package Katerio
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
/**
* -----------------------------------------------------------------------------
* Prev Next Article Simple
* -----------------------------------------------------------------------------
*/
if( ! function_exists( 'th90_prev_next_article' ) ) {
function th90_prev_next_article() {
if ( th90_opt( 'post_nav' ) ) {
if ( _th90_get_adjacent_post() || _th90_get_adjacent_post( false, '', false ) ) { ?>
<div class="element-article article-nav clearfix">
<nav class="entry-navigation">
<div class="entry-navigation-left">
<?php
if ( _th90_get_adjacent_post() ) {
$prevtext = '<span class="nav-item-text">' . esc_html__( 'Previous Post', 'katerio' ) . '</span>';
$title = '<h5>%title</h5>';
$prevthumbnail = '';
if ( has_post_thumbnail( get_previous_post()->ID ) && th90_opt( 'post_nav_thumb' ) ) {
$prevthumbnail = '<div class="nav-thumbnail"><div class="thumb-container thumb-100">' . get_the_post_thumbnail( get_previous_post()->ID ) . '</div></div>';
}
previous_post_link( '%link', "<div class='nav-post'>$prevthumbnail<div class='nav-desc'>$prevtext$title</div></div>" );
}
?>
</div>
<div class="entry-navigation-right">
<?php
if ( _th90_get_adjacent_post( false, '', false ) ) {
$nexttext = '<span class="nav-item-text">' . esc_html__( 'Next Post', 'katerio' ) . '</span>';
$title = '<h5>%title</h5>';
$nextthumbnail = '';
if ( has_post_thumbnail( get_next_post()->ID ) && th90_opt( 'post_nav_thumb' ) ) {
$nextthumbnail = '<div class="nav-thumbnail"><div class="thumb-container thumb-100">' . get_the_post_thumbnail( get_next_post()->ID ) . '</div></div>';
}
next_post_link( '%link', "<div class='nav-post'>$nextthumbnail<div class='nav-desc'>$nexttext$title</div></div>" );
}
?>
</div>
</nav>
</div>
<?php
}
}
}
add_action( 'th90_article_elements_below', 'th90_prev_next_article', 15 );
}
/**
* -----------------------------------------------------------------------------
* Box Author Article
* -----------------------------------------------------------------------------
*/
if( ! function_exists( 'th90_author_box_article' ) ) {
function th90_author_box_article() {
if ( TH90_KATERIO_CORE_ACTIVE && th90_opt( 'post_author' ) ) {
if ( TH90_COAUTHORS_IS_ACTIVE ) {
$show_authors = array();
$author_ids = explode( ',', coauthors_ids( ',', ',', null, null, false ) );
foreach ( $author_ids as $author_id ) {
if ( null !== get_the_author_meta( 'description', $author_id ) ) {
$show_authors[] = $author_id;
}
}
if ( ! empty( $show_authors) ) {
echo '<div class="element-article article-author clearfix">';
foreach ( $show_authors as $author) {
th90_author_box( $author, 110, true );
}
echo '</div>';
}
} else {
if ( get_the_author_meta( 'description', get_the_author_meta( 'ID' ) ) ) {
echo '<div class="element-article article-author clearfix">';
th90_author_box( get_the_author_meta( 'ID' ), 110, true );
echo '</div>';
}
}
}
}
add_action( 'th90_article_elements_below', 'th90_author_box_article', 20 );
}
/**
* -----------------------------------------------------------------------------
* Comments Article
* -----------------------------------------------------------------------------
*/
if( ! function_exists( 'th90_comments_article' ) ) {
function th90_comments_article() {
comments_template();
}
add_action( 'th90_article_elements_below', 'th90_comments_article', 30 );
}
/**
* -----------------------------------------------------------------------------
* Single Post Hooks
* -----------------------------------------------------------------------------
*/
if( ! function_exists( 'th90_article_top_template' ) ) {
function th90_article_top_template() {
$template = th90_display_elementor_content( th90_opt( 'post_content_top' ) );
if ( $template ) {
?>
<div class="article-section article-section-top">
<?php echo apply_filters( 'th90_print_post_content_top_template', $template ); ?>
</div>
<?php
}
}
add_action( 'th90_article_top', 'th90_article_top_template', 10 );
}
if( ! function_exists( 'th90_article_bottom_template' ) ) {
function th90_article_bottom_template() {
$template = th90_display_elementor_content( th90_opt( 'post_content_bottom' ) );
if ( $template ) {
?>
<div class="article-section article-section-bottom">
<?php echo apply_filters( 'th90_print_post_content_bottom_template', $template ); ?>
</div>
<?php
}
}
add_action( 'th90_article_bottom', 'th90_article_bottom_template', 10 );
}