83 lines
3.7 KiB
PHP
83 lines
3.7 KiB
PHP
<?php
|
|
if ( ! defined( 'ABSPATH' ) ) exit; // If this file is called directly, abort.
|
|
|
|
$upstudy_post_thumb_src = wp_get_attachment_image_src( get_post_thumbnail_id( get_the_ID() ), 'upstudy-post-thumb' );
|
|
if ( isset( $upstudy_post_thumb_src ) && ! empty( $upstudy_post_thumb_src ) ) :
|
|
$upstudy_post_thumb_url = $upstudy_post_thumb_src[0];
|
|
else :
|
|
$upstudy_post_thumb_url = '';
|
|
endif;
|
|
$blog_post_desktop_cols = Upstudy::setting( 'related_post_columns' );
|
|
|
|
if ( isset( $_GET['column'] ) && $_GET['column'] == 3 ) :
|
|
$blog_post_desktop_cols = 4;
|
|
endif;
|
|
|
|
$excerpt_length = Upstudy::setting( 'related_excerpt_length' );
|
|
if ( isset( $_GET['excerpt_length'] ) ) :
|
|
$excerpt_length = (int)$_GET['excerpt_length'] ? $_GET['excerpt_length'] : $excerpt_length;
|
|
endif;
|
|
|
|
$related_excerpt_show = Upstudy::setting( 'related_excerpt_show' ) ?: false;
|
|
$related_author_show = Upstudy::setting( 'related_author_show' ) ?: false;
|
|
$related_date_show = Upstudy::setting( 'related_date_show' ) ?: false;
|
|
$related_comment_show = Upstudy::setting( 'related_comment_show' ) ?: false;
|
|
$related_category_show = Upstudy::setting( 'related_category_show' ) ?: false;
|
|
$blog_read_more_btn_show = Upstudy::setting( 'blog_read_more_btn_show' );
|
|
$blog_button_text = Upstudy::setting( 'blog_button_text' ) ?: esc_html__('Read More', 'upstudy');
|
|
?>
|
|
<div id="post-<?php the_ID(); ?>" <?php post_class( 'upstudy-post-one-single-grid upstudy-col-lg-' . esc_attr( $blog_post_desktop_cols ) . ' upstudy-col-md-6 upstudy-col-sm-12' ); ?> data-sal>
|
|
<?php
|
|
echo '<div class="edu-blog blog-style-3">';
|
|
echo '<div class="inner">';
|
|
if ( $upstudy_post_thumb_url ) :
|
|
echo '<div class="thumbnail">';
|
|
|
|
echo '<a href="' . esc_url( get_the_permalink() ) . '">';
|
|
echo '<img src="' . esc_url( $upstudy_post_thumb_url ). '" alt="' . esc_attr( upstudy_thumbanil_alt_text( get_post_thumbnail_id( get_the_id() ) ) ). '" >';
|
|
echo '</a>';
|
|
|
|
if ( $related_date_show ) {
|
|
echo '<span class="date">';
|
|
echo '<span class="upstudy_date">' . esc_html( get_the_date( 'd' ) ) . '</span>';
|
|
echo '<span class="upstudy_months">' . esc_html( get_the_date( 'M' ) ) . '</span>';
|
|
echo '</span>';
|
|
}
|
|
|
|
echo '</div>';
|
|
endif;
|
|
|
|
echo '<div class="content position-top">';
|
|
|
|
if ($related_category_show ) {
|
|
echo '<ul class="blog-meta">';
|
|
|
|
if ( 'post' === get_post_type() && $related_author_show ): upstudy_posted_author(); endif;
|
|
|
|
if ( $related_category_show && upstudy_category_by_id( get_the_ID())) {
|
|
echo '<li class="meta-blog-cat">';
|
|
echo wp_kses_post( upstudy_category_by_id( get_the_ID(), 'category' ) );
|
|
echo '</li>';
|
|
}
|
|
|
|
echo '</ul>';
|
|
}
|
|
|
|
echo upstudy_get_title( 'h4' );
|
|
|
|
if ($related_excerpt_show) {
|
|
echo wpautop( wp_trim_words( wp_kses_post( get_the_excerpt() ), esc_html( $excerpt_length ), '...' ) );
|
|
}
|
|
|
|
if ( $blog_read_more_btn_show ) {
|
|
echo '<div class="upstudy-blog-readmore">';
|
|
echo '<a class="upstudy-blog-btn" href="' . esc_url( get_the_permalink() ) . '">';
|
|
echo esc_html( $blog_button_text );
|
|
echo '</a>';
|
|
echo '</div>';
|
|
}
|
|
|
|
echo '</div>';
|
|
echo '</div>';
|
|
echo '</div>';
|
|
echo '</div>';
|