Brak opisu

description.php 3.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <?php
  2. if ( !empty( $options['display_title'] ) ) {
  3. echo "<h2>{$brand_term->name}</h2>";
  4. }
  5. if ( !empty( $options['banner_display'] ) && !empty( $brand_banner = get_term_meta( $brand_term->term_id, 'brand_banner_url', true ) ) ) {
  6. $banner_width = empty( $options['banner_width'] ) ? '' : "width:{$options['banner_width']}{$options['banner_width_units']};";
  7. $banner_height = empty( $options['banner_height'] ) ? '' : "height:{$options['banner_height']}{$options['banner_height_units']};";
  8. $banner_fit = empty( $options['banner_fit'] ) ? '' : "object-fit:{$options['banner_fit']};";
  9. $banner_align = empty( $options['banner_align'] ) ? ''
  10. : ( $options['banner_align'] == 'center' ? 'margin-left: auto; margin-right: auto;'
  11. : "float:{$options['banner_align']};" );
  12. echo "<img class='br_brand_image br_brand_banner' src='$brand_banner' alt='{$brand_term->name}' style='$banner_width $banner_height $banner_align $banner_fit'>";
  13. }
  14. echo '<div class="berocket_brand_description">';
  15. if ( !empty( $options['thumbnail_display'] )
  16. && !empty( $brand_thumbnail = get_term_meta( $brand_term->term_id, 'brand_image_url', true ) ) ) {
  17. $thumbnail_width = empty( $options['thumbnail_width'] ) ? ''
  18. : "width:{$options['thumbnail_width']}{$options['thumbnail_width_units']};";
  19. $thumbnail_height = empty( $options['thumbnail_height'] ) ? ''
  20. : "height:{$options['thumbnail_height']}{$options['thumbnail_height_units']};";
  21. $thumbnail_fit = empty( $options['thumbnail_fit'] ) ? '' : "object-fit:{$options['thumbnail_fit']};";
  22. $thumbnail_align = empty( $options['thumbnail_align'] ) ? '' : "float:{$options['thumbnail_align']};";
  23. echo "<img class='br_brand_image br_brand_thumbnail {$tooltip['class']}' src='$brand_thumbnail' alt='{$brand_term->name}' style='$thumbnail_width $thumbnail_height $thumbnail_align $thumbnail_fit' {$tooltip['data']} />";
  24. }
  25. if( !empty( $options['display_description'] ) ) {
  26. echo '<div class="text">'. do_shortcode( term_description( $brand_term ) ).'</div>';
  27. }
  28. if( !empty( $options['display_link'] ) && !empty( $brand_url = get_term_meta( $brand_term->term_id, 'br_brand_url', true ) ) ) {
  29. $target = empty( $options['link_open_in_new_tab'] ) ? '' : "target='_blank'";
  30. echo "<a class='br_brand_link' $target href=$brand_url>{$options['link_text']}</a>";
  31. }
  32. if( !empty( $options['related_products_display'] )
  33. && !empty( $related_products = get_term_meta( $brand_term->term_id, 'br_brand_related', true ) ) ) {
  34. echo '<h4>' . __( 'Related products', 'brands-for-woocommerce' ) . '</h4>';
  35. $get_argument = 'br_brands_related';
  36. if ( empty( $options['related_products_slider'] ) ) {
  37. $per_page = empty( $options['related_products_per_page'] ) ? -1 : $options['related_products_per_page'];
  38. $paged = isset( $_GET[ $get_argument ] ) ? (int) $_GET[ $get_argument ] : 1;
  39. } else {
  40. $paged = false;
  41. $per_page = -1;
  42. }
  43. $products = wc_get_products(array(
  44. 'status' => 'publish',
  45. 'limit' => $per_page,
  46. 'page' => $paged,
  47. 'paginate' => true,
  48. 'return' => 'ids',
  49. 'orderby' => $options['related_products_orderby'],
  50. 'order' => $options['related_products_order'],
  51. 'include' => $related_products,
  52. ));
  53. brfr_product_loop( $products, array(
  54. 'columns' => $options['related_products_columns'],
  55. 'cache_key' => $get_argument,
  56. 'slider' => $options['related_products_slider'],
  57. 'hide_brands' => $options['related_products_hide_brands'],
  58. 'paged' => $paged,
  59. ) );
  60. }
  61. echo '</div>';
  62. ?>