Changeset 2334527
- Timestamp:
- 07/02/2020 09:42:38 PM (6 years ago)
- Location:
- better-elementor-addons/trunk/widgets/post
- Files:
-
- 3 edited
-
post-author.php (modified) (1 diff)
-
post-date.php (modified) (3 diffs)
-
post-featured-image.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
better-elementor-addons/trunk/widgets/post/post-author.php
r2334514 r2334527 334 334 335 335 protected function _content_template() { 336 ?>337 <#338 var author_data = [];339 <?php340 foreach ( $this->user_data() as $key => $value ) {341 printf( 'author_data[ "%1$s" ] = "%2$s";', $key, $value );342 }343 ?>344 var author = author_data[ settings.author ];345 346 var link_url;347 switch( settings.link_to ) {348 case 'custom':349 link_url = settings.link.url;350 break;351 case 'author':352 link_url = '<?php echo esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ); ?>';353 break;354 case 'post':355 link_url = '<?php echo esc_url( get_the_permalink() ); ?>';356 break;357 case 'home':358 link_url = '<?php echo esc_url( get_home_url() ); ?>';359 break;360 case 'none':361 default:362 link_url = false;363 }364 var target = settings.link.is_external ? 'target="_blank"' : '';365 366 var animation_class = '';367 if ( '' !== settings.hover_animation ) {368 animation_class = 'elementor-animation-' + settings.hover_animation;369 }370 371 var html = '<' + settings.html_tag + ' class="better-widgets-author ' + animation_class + '">';372 if ( link_url ) {373 html += '<a href="' + link_url + '" ' + target + '>' + author + '</a>';374 } else {375 html += author;376 }377 html += '</' + settings.html_tag + '>';378 379 print( html );380 #>381 <?php382 336 } 383 337 -
better-elementor-addons/trunk/widgets/post/post-date.php
r2334516 r2334527 117 117 ); 118 118 119 $this->add_control(120 'link_to',121 [122 'label' => __( 'Link to', 'better-widgets' ),123 'type' => Controls_Manager::SELECT,124 'default' => 'none',125 'options' => [126 'none' => __( 'None', 'better-widgets' ),127 'home' => __( 'Home URL', 'better-widgets' ),128 'post' => 'Post',129 'custom' => __( 'Custom URL', 'better-widgets' ),130 ],131 ]132 );133 134 $this->add_control(135 'link',136 [137 'label' => __( 'Link', 'better-widgets' ),138 'type' => Controls_Manager::URL,139 'placeholder' => __( 'https://your-link.com', 'better-widgets' ),140 'condition' => [141 'link_to' => 'custom',142 ],143 'default' => [144 'url' => '',145 ],146 'show_label' => false,147 ]148 );149 150 119 $this->end_controls_section(); 151 120 … … 228 197 229 198 $link = false; 230 $target = $settings['link']['is_external'] ? 'target="_blank"' : '';231 199 232 200 $animation_class = ! empty( $settings['hover_animation'] ) ? 'elementor-animation-' . $settings['hover_animation'] : ''; 233 201 234 202 $html = sprintf( '<%1$s class="better-widgets-date %2$s">', $settings['html_tag'], $animation_class ); 235 if ( $link ) { 236 $html .= sprintf( '<a href="%1$s" %2$s>%3$s</a>', $link, $target, $date ); 237 } else { 238 $html .= $date; 239 } 203 $html .= $date; 240 204 $html .= sprintf( '</%s>', $settings['html_tag'] ); 241 205 … … 244 208 245 209 protected function _content_template() { 246 ?>247 <#248 // Backwards compitability check249 var datetype;250 if (settings.date_type) {251 datetype = settings.date_type;252 } else {253 datetype = "publish";254 }255 256 var data_fields = [];257 data_fields[ "modified" ] = "<?php echo get_the_modified_date(); ?>";258 data_fields[ "publish" ] = "<?php echo get_the_date(); ?>";259 260 var date = data_fields[ datetype ];261 262 var link_url;263 switch( settings.link_to ) {264 case 'custom':265 link_url = settings.link.url;266 break;267 case 'post':268 link_url = '<?php echo esc_url( get_the_permalink() ); ?>';269 break;270 case 'home':271 link_url = '<?php echo esc_url( get_home_url() ); ?>';272 break;273 case 'none':274 default:275 link_url = false;276 }277 var target = settings.link.is_external ? 'target="_blank"' : '';278 279 var animation_class = '';280 if ( '' !== settings.hover_animation ) {281 animation_class = 'elementor-animation-' + settings.hover_animation;282 }283 284 var html = '<' + settings.html_tag + ' class="better-widgets-date ' + animation_class + '">';285 if ( link_url ) {286 html += '<a href="' + link_url + '" ' + target + '>' + date + '</a>';287 } else {288 html += date;289 }290 html += '</' + settings.html_tag + '>';291 292 print( html );293 #>294 <?php295 210 } 296 211 } -
better-elementor-addons/trunk/widgets/post/post-featured-image.php
r2334516 r2334527 277 277 protected function _content_template() { 278 278 279 $image_url = wp_get_attachment_image_src( get_post_thumbnail_id(), 'large' );280 ?>281 <#282 var featured_images = [];283 <?php284 $all_image_sizes = Group_Control_Image_Size::get_all_image_sizes();285 foreach ( $all_image_sizes as $key => $value ) {286 printf( 'featured_images[ "%1$s" ] = \'%2$s\';', $key, get_the_post_thumbnail( null, $key ) );287 }288 printf( 'featured_images[ "full" ] = \'%2$s\';', $key, get_the_post_thumbnail( null, 'full' ) );289 ?>290 var featured_image = featured_images[ settings.size_size ];291 292 var link_url;293 switch( settings.link_to ) {294 case 'custom':295 link_url = settings.link.url;296 break;297 case 'file':298 link_url = '<?php echo esc_url( $image_url[0] ); ?>';299 break;300 case 'post':301 link_url = '<?php echo esc_url( get_the_permalink() ); ?>';302 break;303 case 'home':304 link_url = '<?php echo esc_url( get_home_url() ); ?>';305 break;306 case 'none':307 default:308 link_url = false;309 }310 311 var animation_class = '';312 if ( '' !== settings.hover_animation ) {313 animation_class = 'elementor-animation-' + settings.hover_animation;314 }315 316 var html = '<div class="better-widgets-featured-image ' + animation_class + '">';317 if ( link_url ) {318 html += '<a href="' + link_url + '">' + featured_image + '</a>';319 } else {320 html += featured_image;321 }322 html += '</div>';323 324 print( html );325 #>326 <?php327 328 279 } 329 280
Note: See TracChangeset
for help on using the changeset viewer.