| 1 |
<?php |
| 2 |
/** |
| 3 |
* Template: Post List |
| 4 |
* |
| 5 |
* @package RadiusTheme\SB |
| 6 |
*/ |
| 7 |
|
| 8 |
/** |
| 9 |
* Template variables: |
| 10 |
* |
| 11 |
* @var $grid_classes string |
| 12 |
* @var $title string |
| 13 |
* @var $title_link string |
| 14 |
* @var $excerpt string |
| 15 |
* @var $title_tag string |
| 16 |
* @var $title_limit string |
| 17 |
* @var $excerpt_limit string |
| 18 |
* @var $button_text string |
| 19 |
* @var $show_title boolean |
| 20 |
* @var $show_categories boolean |
| 21 |
* @var $show_tags boolean |
| 22 |
* @var $show_dates boolean |
| 23 |
* @var $show_author boolean |
| 24 |
* @var $show_comment boolean |
| 25 |
* @var $show_reading_time boolean |
| 26 |
* @var $show_post_views boolean |
| 27 |
* @var $show_post_thumbnail boolean |
| 28 |
* @var $show_short_desc boolean |
| 29 |
* @var $image_link boolean |
| 30 |
* @var $show_read_more_btn boolean |
| 31 |
* @var $show_author_icon boolean |
| 32 |
* @var $show_comment_icon boolean |
| 33 |
* @var $show_date_icon boolean |
| 34 |
* @var $show_reading_time_icon boolean |
| 35 |
* @var $show_post_views_icon boolean |
| 36 |
* @var $img_html string |
| 37 |
* @var $button_icon array |
| 38 |
* @var $button_icon_position string |
| 39 |
* @var $item_class string |
| 40 |
* @var $author_icon_html string |
| 41 |
* @var $date_icon_html string |
| 42 |
* @var $comment_icon_html string |
| 43 |
* @var $reading_time_icon_html string |
| 44 |
* @var $post_views_icon_html string |
| 45 |
* @var $meta_separator string |
| 46 |
* array |
| 47 |
*/ |
| 48 |
|
| 49 |
// Do not allow directly accessing this file. |
| 50 |
|
| 51 |
|
| 52 |
use RadiusTheme\SB\Elementor\Helper\PostHelpers; |
| 53 |
use RadiusTheme\SB\Elementor\Widgets\General\PostList\Render; |
| 54 |
use RadiusTheme\SB\Helpers\Fns; |
| 55 |
|
| 56 |
if ( ! defined( 'ABSPATH' ) ) { |
| 57 |
exit( 'This script cannot be accessed directly.' ); |
| 58 |
} |
| 59 |
$date_icon = '<svg xmlns="https://www.w3.org/2000/svg" viewBox="0 0 448 512" width="1em" height="1em" fill="currentColor"><path d="M0 464c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V192H0v272zm320-196c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12v40c0 6.6-5.4 12-12 12h-40c-6.6 0-12-5.4-12-12v-40zm0 128c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12v40c0 6.6-5.4 12-12 12h-40c-6.6 0-12-5.4-12-12v-40zM192 268c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12v40c0 6.6-5.4 12-12 12h-40c-6.6 0-12-5.4-12-12v-40zm0 128c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12v40c0 6.6-5.4 12-12 12h-40c-6.6 0-12-5.4-12-12v-40zM64 268c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12v40c0 6.6-5.4 12-12 12H76c-6.6 0-12-5.4-12-12v-40zm0 128c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12v40c0 6.6-5.4 12-12 12H76c-6.6 0-12-5.4-12-12v-40zM400 64h-48V16c0-8.8-7.2-16-16-16h-32c-8.8 0-16 7.2-16 16v48H160V16c0-8.8-7.2-16-16-16h-32c-8.8 0-16 7.2-16 16v48H48C21.5 64 0 85.5 0 112v48h448v-48c0-26.5-21.5-48-48-48z"></path></svg>'; |
| 60 |
?> |
| 61 |
<div class="<?php echo esc_attr( $grid_classes ); ?>"> |
| 62 |
<div class="<?php echo esc_attr( $item_class ); ?>"> |
| 63 |
<article> |
| 64 |
<?php if ( $show_post_thumbnail ) { ?> |
| 65 |
<div class="rtsb-post-img rtsb-img-wrap"> |
| 66 |
<?php |
| 67 |
if ( $image_link ) { |
| 68 |
$aria_label = esc_attr( |
| 69 |
/* translators: Post Name */ |
| 70 |
sprintf( __( 'Image link for Post: %s', 'shopbuilder' ), $title ) |
| 71 |
); |
| 72 |
?> |
| 73 |
<figure> |
| 74 |
<a class="rtsb-img-link" href="<?php the_permalink(); ?>" aria-label="<?php echo esc_attr( $aria_label ); ?>"> |
| 75 |
<?php |
| 76 |
Fns::print_html( $img_html ); |
| 77 |
?> |
| 78 |
</a> |
| 79 |
</figure> |
| 80 |
<?php |
| 81 |
} else { |
| 82 |
echo '<figure class="rtsb-img-link">'; |
| 83 |
Fns::print_html( $img_html ); |
| 84 |
echo '</figure>'; |
| 85 |
} |
| 86 |
?> |
| 87 |
<?php |
| 88 |
if ( $show_categories || $show_tags ) { |
| 89 |
?> |
| 90 |
<ul class="rtsb-post-taxonomy-list"> |
| 91 |
<?php |
| 92 |
if ( $show_categories ) { |
| 93 |
Fns::print_html( '<li class="rtsb-tax-item category">' ); |
| 94 |
Fns::print_html( PostHelpers::rtsb_posted_taxonomy() ); |
| 95 |
Fns::print_html( '</li>' ); |
| 96 |
} |
| 97 |
if ( $show_tags ) { |
| 98 |
Fns::print_html( '<li class="rtsb-tax-item tag">' ); |
| 99 |
Fns::print_html( PostHelpers::rtsb_posted_taxonomy( 'tag' ) ); |
| 100 |
Fns::print_html( '</li>' ); |
| 101 |
} |
| 102 |
?> |
| 103 |
|
| 104 |
</ul> |
| 105 |
<?php |
| 106 |
} |
| 107 |
?> |
| 108 |
</div> |
| 109 |
<?php } ?> |
| 110 |
<div class="rtsb-post-content"> |
| 111 |
<?php |
| 112 |
if ( $show_dates || $show_author || $show_comment || $show_reading_time || $show_post_views ) { |
| 113 |
?> |
| 114 |
<ul class="rtsb-post-meta"> |
| 115 |
<?php |
| 116 |
if ( $show_author ) { |
| 117 |
$prefix = esc_html__( 'By ', 'shopbuilder' ); |
| 118 |
$prefix = apply_filters( 'rtsb/general_widgets/posts_author_prefix', $prefix ); |
| 119 |
Fns::print_html( '<li class="rtsb-meta-item author">' ); |
| 120 |
if ( $show_author_icon ) { |
| 121 |
Fns::print_html( $author_icon_html ); |
| 122 |
} |
| 123 |
Fns::print_html( PostHelpers::rtsb_posted_by( $prefix ) ); |
| 124 |
Fns::print_html( '</li>' ); |
| 125 |
} |
| 126 |
if ( $show_dates ) { |
| 127 |
if ( $meta_separator ) { |
| 128 |
Fns::print_html( '<li class="rtsb-meta-separator">' ); |
| 129 |
Fns::print_html( $meta_separator ); |
| 130 |
Fns::print_html( '</li>' ); |
| 131 |
} |
| 132 |
Fns::print_html( '<li class="rtsb-meta-item date">' ); |
| 133 |
if ( $show_date_icon ) { |
| 134 |
Fns::print_html( $date_icon_html ); |
| 135 |
} |
| 136 |
Fns::print_html( PostHelpers::rtsb_posted_date() ); |
| 137 |
Fns::print_html( '</li>' ); |
| 138 |
} |
| 139 |
if ( $show_comment ) { |
| 140 |
if ( $meta_separator ) { |
| 141 |
Fns::print_html( '<li class="rtsb-meta-separator">' ); |
| 142 |
Fns::print_html( $meta_separator ); |
| 143 |
Fns::print_html( '</li>' ); |
| 144 |
} |
| 145 |
Fns::print_html( '<li class="rtsb-meta-item comments">' ); |
| 146 |
if ( $show_comment_icon ) { |
| 147 |
Fns::print_html( $comment_icon_html ); |
| 148 |
} |
| 149 |
Fns::print_html( PostHelpers::get_post_comments_number() ); |
| 150 |
Fns::print_html( '</li>' ); |
| 151 |
} |
| 152 |
if ( $show_reading_time ) { |
| 153 |
if ( $meta_separator ) { |
| 154 |
Fns::print_html( '<li class="rtsb-meta-separator">' ); |
| 155 |
Fns::print_html( $meta_separator ); |
| 156 |
Fns::print_html( '</li>' ); |
| 157 |
} |
| 158 |
Fns::print_html( '<li class="rtsb-meta-item reading-time">' ); |
| 159 |
if ( $show_reading_time_icon ) { |
| 160 |
Fns::print_html( $reading_time_icon_html ); |
| 161 |
} |
| 162 |
Fns::print_html( PostHelpers::rtsb_reading_time() ); |
| 163 |
Fns::print_html( '</li>' ); |
| 164 |
} |
| 165 |
if ( $show_post_views ) { |
| 166 |
if ( $meta_separator ) { |
| 167 |
Fns::print_html( '<li class="rtsb-meta-separator">' ); |
| 168 |
Fns::print_html( $meta_separator ); |
| 169 |
Fns::print_html( '</li>' ); |
| 170 |
} |
| 171 |
Fns::print_html( '<li class="rtsb-meta-item post-views">' ); |
| 172 |
if ( $show_post_views_icon ) { |
| 173 |
Fns::print_html( $post_views_icon_html ); |
| 174 |
} |
| 175 |
Fns::print_html( PostHelpers::rtsb_post_views() ); |
| 176 |
Fns::print_html( '</li>' ); |
| 177 |
} |
| 178 |
?> |
| 179 |
</ul> |
| 180 |
<?php |
| 181 |
} |
| 182 |
?> |
| 183 |
<?php |
| 184 |
if ( $show_title ) { |
| 185 |
?> |
| 186 |
<<?php Fns::print_validated_html_tag( $title_tag ); ?> class="rtsb-post-title limit-<?php echo esc_attr( $title_limit ); ?>"> |
| 187 |
<?php |
| 188 |
if ( $title_link ) { |
| 189 |
?> |
| 190 |
<a class="rtsb-title-link" href="<?php the_permalink(); ?>"><?php Fns::print_html( $title ); ?></a> |
| 191 |
<?php |
| 192 |
} else { |
| 193 |
Fns::print_html( $title ); |
| 194 |
} |
| 195 |
?> |
| 196 |
</<?php Fns::print_validated_html_tag( $title_tag ); ?>> |
| 197 |
<?php |
| 198 |
} |
| 199 |
if ( $show_short_desc ) { |
| 200 |
?> |
| 201 |
<div class="rtsb-post-excerpt limit-<?php Fns::print_html( $excerpt_limit ); ?>"> |
| 202 |
<?php Fns::print_html( $excerpt ); ?> |
| 203 |
</div> |
| 204 |
<?php |
| 205 |
} |
| 206 |
?> |
| 207 |
<?php |
| 208 |
/** |
| 209 |
* Button. |
| 210 |
*/ |
| 211 |
if ( $show_read_more_btn ) { |
| 212 |
?> |
| 213 |
<div class="rtsb-button-wrapper"> |
| 214 |
<a class="rtsb-readmore-btn" href="<?php the_permalink(); ?>"> |
| 215 |
<span class="text-wrap"> |
| 216 |
<?php |
| 217 |
Fns::print_html( Render::render_icon( 'left', $button_icon, $button_icon_position ) ); |
| 218 |
Fns::print_html( $button_text ); |
| 219 |
Fns::print_html( Render::render_icon( 'right', $button_icon, $button_icon_position ) ); |
| 220 |
?> |
| 221 |
</span> |
| 222 |
</a> |
| 223 |
</div> |
| 224 |
<?php } ?> |
| 225 |
</div> |
| 226 |
</article> |
| 227 |
</div> |
| 228 |
</div> |
| 229 |
|