Files
2026-04-23 04:33:43 +03:30

84 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 = 12/Upstudy::setting( 'blog_post_columns' );
if ( isset( $_GET['column'] ) && $_GET['column'] == 3 ) :
$blog_post_desktop_cols = 4;
endif;
$excerpt_length = Upstudy::setting( 'blog_excerpt_length' );
if ( isset( $_GET['excerpt_length'] ) ) :
$excerpt_length = (int)$_GET['excerpt_length'] ? $_GET['excerpt_length'] : $excerpt_length;
endif;
$masonry_status = Upstudy::setting( 'blog_masonry_show' );
if ( $masonry_status || isset( $_GET['masonry'] ) ) :
$blog_post_desktop_cols = $blog_post_desktop_cols . ' ' . 'tpc-masonry-item';
endif;
$blog_comments_text = Upstudy::setting( 'blog_comments_text' ) ?: esc_html__('Comments', 'upstudy');
$blog_author_show = Upstudy::setting( 'blog_author_show' ) ?: true;
$blog_date_show = Upstudy::setting( 'blog_date_show' ) ?: true;
$blog_comment_show = Upstudy::setting( 'blog_comment_show' ) ?: true;
$blog_category_show = Upstudy::setting( 'blog_category_show' );
$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 ( $blog_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">';
echo '<ul class="blog-meta">';
if ( 'post' === get_post_type() && $blog_author_show ): upstudy_posted_author(); endif;
if ( $blog_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' );
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>';