show_post_thumbnail ) ? $settings->show_post_thumbnail : '';
if ( $show_post_thumbnail === 'no' ) {
return;
}
$size = ! empty( $settings->image_size ) ? $settings->image_size : 'post-thumbnail';
$pid = get_the_ID();
$img = get_the_post_thumbnail_url( $pid, $size );
if ( ! empty( $img ) ) {
$thumbnail_shadow = ! empty( $settings->thumbnail_shadow ) && $settings->thumbnail_shadow === 'yes' ? 'obfx-card' : '';
echo '
';
if ( ! empty( $settings->show_thumbnail_link ) && $settings->show_thumbnail_link === 'yes' ) {
echo '
';
}
echo ' . ')
';
if ( ! empty( $settings->show_thumbnail_link ) && $settings->show_thumbnail_link === 'yes' ) {
echo '';
}
}
}
}
if ( ! function_exists( 'obfx_show_post_grid_title' ) ) {
/**
* Display post grid title.
*
* @param array $settings Post grid settings.
*/
function obfx_show_post_grid_title( $settings ) {
if ( empty( $settings ) ) {
return;
}
$show_post_title = ! empty( $settings->show_post_title ) ? $settings->show_post_title : '';
if ( $show_post_title === 'no' ) {
return;
}
if ( ! empty( $settings->show_title_link ) && $settings->show_title_link === 'yes' ) {
echo '';
if ( in_array( 'author', $meta_data, true ) ) {
$author_id = get_post_field( 'post_author', $pid );
$author = get_the_author_meta( 'display_name', $author_id );
if ( ! empty( $author ) ) {
echo '
';
if ( $show_icons === 'yes' ) {
echo '
';
}
printf(
/* translators: %1$s is Author name wrapped, %2$s is Time */
esc_html__( 'By %1$s', 'themeisle-companion' ),
sprintf(
/* translators: %1$s is Author name, %2$s is author link */
'
%1$s',
esc_html( get_the_author() ),
esc_url( get_author_posts_url( $author_id ) )
)
);
echo '
';
}
}
if ( in_array( 'date', $meta_data, true ) ) {
echo '
';
if ( $show_icons === 'yes' ) {
echo '';
}
echo get_the_date();
echo '
';
}
if ( in_array( 'category', $meta_data, true ) ) {
$cat = get_the_category();
if ( ! empty( $cat ) ) {
echo '
';
}
}
if ( in_array( 'tags', $meta_data, true ) ) {
$tags = wp_get_post_tags( $pid );
if ( ! empty( $tags ) ) {
echo '
';
}
}
if ( in_array( 'comments', $meta_data, true ) ) {
echo '';
}
echo '
';
}
}
if ( ! function_exists( 'obfx_show_post_grid_content' ) ) {
/**
* Display post grid content.
*
* @param array $settings Post grid settings.
*/
function obfx_show_post_grid_content( $settings ) {
if ( empty( $settings ) ) {
return;
}
$show_post_content = ! empty( $settings->show_post_content ) ? $settings->show_post_content : '';
if ( $show_post_content === 'no' ) {
return;
}
$number_of_words = ! empty( $settings->content_length ) ? $settings->content_length : '';
echo '';
if ( ! empty( $number_of_words ) ) {
$content = obfx_get_limited_content( $number_of_words, $settings );
echo '
' . wp_kses_post( $content ) . '
';
}
echo '
';
}
}
if ( ! function_exists( 'obfx_get_limited_content' ) ) {
/**
* Get content with limited number of words.
*
* @param int $limit Words limit.
*
* @return string
*/
function obfx_get_limited_content( $limit, $settings ) {
$content = explode( ' ', get_the_content(), $limit );
$show_read_more = ! empty( $settings->show_read_more ) ? $settings->show_read_more : '';
$read_more = $show_read_more === 'yes' ? ( ! empty( $settings->read_more_text ) ? '';
echo '
';
obfx_show_post_grid_thumbnail( $settings );
obfx_show_post_grid_title( $settings );
obfx_show_post_grid_meta( $settings );
obfx_show_post_grid_content( $settings );
echo '
';
echo '
';
}
if ( $settings->show_pagination === 'yes' ) {
echo '';
}
}
wp_reset_postdata();