Advertisement
Guest User

ACF

a guest
Jan 20th, 2020
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.30 KB | None | 0 0
  1. <?php
  2. elseif ( get_row_layout() == 'tooltips' || get_row_layout() == 'tooltips_en' ):
  3. ?>
  4. <!-- Start alternating columns -->
  5. <?php
  6. $bgswitch = get_sub_field_object( 'bg_switch' );
  7.  
  8.  
  9. if ( $bgswitch['value'] == 'custom' ) {
  10.  
  11. get_template_part( 'template-parts/page/custom-tooltip-image' );
  12. }
  13.  
  14.  
  15. if ( $bgswitch['value'] == 'vy' || $bgswitch['value'] == 'vu' ) {
  16. ?>
  17. <div class="tt-v-block video-block">
  18. <?php
  19. }
  20. ?>
  21. <div class="container" id="b<?php echo $block_counter; ?>">
  22. <div class="row">
  23. <div class="tooltip-image-container">
  24. <?php
  25. $tooltipBoxCounter = 0;
  26. while ( have_rows( 'tooltips_container' ) ): the_row();
  27. $tooltipBoxCounter ++;
  28. ?>
  29.  
  30. <?php $rng_for_click = uniqid(); ?>
  31.  
  32. <a title="" class="tooltip-anker small"
  33. data-anker="<?php echo $rng_for_click; ?>-<?php echo $tooltipBoxCounter; ?>"
  34. style="left: <?php the_sub_field( 'tooltip_x_position' ); ?>%; top: <?php the_sub_field( 'tooltip_y_position' ); ?>%;">
  35. <img class="tooltip-graphic"
  36. src="<?php bloginfo( 'template_directory' ); ?>/assets/images/signal-icon-<?php the_sub_field( 'color_tooltip_image' ); ?>.svg"
  37. alt=""/>
  38. </a>
  39. <?php
  40. $tooltip_x_pos;
  41. if ( get_sub_field( 'tooltip_x_position' ) > 75 || get_sub_field( 'tooltip_x_position' ) < 25 ) {
  42. if ( get_sub_field( 'tooltip_x_position' ) > 75 ) {
  43. $tooltip_x_pos = 75;
  44. } else {
  45. //if(get_sub_field('tooltip_x_position') < 25)
  46. $tooltip_x_pos = 25;
  47. }
  48. } else {
  49. $tooltip_x_pos = get_sub_field( 'tooltip_x_position' );
  50. }
  51. ?>
  52. <div class="tooltip-box <?php echo $rng_for_click ?>-<?php echo $tooltipBoxCounter; ?>"
  53. data-anker="<?php echo $rng_for_click; ?>-<?php echo $tooltipBoxCounter; ?>"
  54. style="left: <?php echo $tooltip_x_pos; ?>%; top: <?php the_sub_field( 'tooltip_y_position' ); ?>%;">
  55. <a class="close-button">
  56. <img src="<?php bloginfo( 'template_directory' ); ?>/assets/images/close-button.svg"
  57. alt=""/>
  58. </a>
  59. <?php
  60. the_sub_field( 'tooltip_content' );
  61. $ttiplink = get_sub_field( 'tooltip_link' );
  62. ?>
  63. <?php if ( $ttiplink ): ?>
  64. <?php
  65. if ( $ttiplink['title'] ) {
  66. $labeltext = $ttiplink['title'];
  67. } else {
  68. $labeltext = 'Mehr erfahren';
  69. }
  70. ?>
  71. <a href="<?php echo $ttiplink['url']; ?>"
  72. title="<?php echo $labeltext; ?>"><?php echo $labeltext; ?></a>
  73. <?php endif; ?>
  74. </div>
  75. <?php endwhile; ?>
  76. <?php
  77. $bgswitch = get_sub_field_object( 'bg_switch' );
  78. if ( $bgswitch['value'] == 'vy' ) {
  79. //youtube video
  80. $tooltipVideo = get_sub_field( "tooltip_video" );
  81. //get iframe HTML
  82. preg_match( '/src="(.+?)"/', $tooltipVideo, $matches );
  83. $src = $matches[1];
  84. //setting variables for array
  85. $ctrl = 0;
  86. $mute = 0;
  87. $autoplay = 1;
  88. if ( get_sub_field( 'video_control' ) ) {
  89. $ctrl = 1;
  90. $autoplay = 0;
  91. }
  92. if ( get_sub_field( 'video_mute' ) ) {
  93. $mute = 1;
  94. }
  95.  
  96. // add extra params to iframe src
  97. $params = array(
  98. 'controls' => $ctrl,
  99. 'hd' => 1,
  100. 'autohide' => 1,
  101. 'autoplay' => $autoplay,
  102. 'showinfo' => 0,
  103. 'modestbranding' => 1,
  104. 'allowfullscreen' => 1,
  105. 'disablekb' => 1,
  106. 'fs' => 0,
  107. 'loop' => 1,
  108. 'iv_load_policy' => 3,
  109. 'playlist' => $src,
  110. 'mute' => $mute
  111. );
  112. $new_src = add_query_arg( $params, $src );
  113. $tooltipVideo = str_replace( $src, $new_src, $tooltipVideo );
  114. // add extra attributes to iframe html
  115. $attributes = 'frameborder="0"';
  116. $tooltipVideo = str_replace( '></iframe>', ' ' . $attributes . '></iframe>', $tooltipVideo );
  117. ?>
  118.  
  119. <div class="heading">
  120. <h2><?php echo get_sub_field( 'headline_video' ); ?></h2>
  121. <div class="text">
  122. <?php echo get_sub_field( 'video_description' ); ?>
  123. </div>
  124. </div>
  125. <div class="video-wrap">
  126. <?php
  127. if ( $ctrl == 0 ) {
  128. ?>
  129. <div class="fence"></div>
  130. <?php
  131. }
  132. ?>
  133.  
  134. <?php
  135. // echo $tooltipVideo
  136. echo $tooltipVideo;
  137. ?>
  138. </div>
  139. <?php
  140. } else {
  141.  
  142. if ( $bgswitch['value'] == 'vu' ) {
  143. //setting variables for array
  144. $ctrl = 0;
  145. $mute = 0;
  146. $autoplay = 1;
  147. if ( get_sub_field( 'video_control' ) ) {
  148. $ctrl = 1;
  149. $autoplay = 0;
  150. }
  151. if ( get_sub_field( 'video_mute' ) ) {
  152. $mute = 1;
  153. }
  154. //upload video
  155. ?>
  156. <div class="heading video-heading">
  157. <h2 class="text-white"><?php echo get_sub_field( 'headline_video' ); ?></h2>
  158. <div class="text text-white">
  159. <?php echo get_sub_field( 'video_description' ); ?>
  160. </div>
  161. </div>
  162. <div class="video-wrap uploaded">
  163. <video <?php if ( $ctrl == 1 ): ?> controls="controls" <?php endif; ?> <?php if ( $autoplay == 1 ): ?> autoplay="autoplay" <?php endif; ?>
  164. preload="auto" <?php if ( $mute == 1 ): ?> muted="muted" <?php endif; ?>
  165. src="<?php the_sub_field( 'uploaded_video' ); ?>">
  166. </div>
  167. <?php
  168. } else {
  169. //image
  170. $tooltipImage = get_sub_field( 'tooltip_image' );
  171. $tooltipImageID = $tooltipImage['ID'];
  172. echo wp_get_attachment_image( $tooltipImageID, 'tooltip_image', false );
  173. }
  174. }
  175. ?>
  176. </div>
  177. </div>
  178. </div>
  179. <?php
  180. if ( $bgswitch['value'] == 'vy' || $bgswitch['value'] == 'vu' ) {
  181. ?>
  182. </div>
  183. <?php
  184. }
  185. ?>
  186. <!-- End content -->
  187. <?php
  188. elseif ( get_row_layout() == 'two_columns' ):
  189. ?>
  190. <!-- Start alternating columns -->
  191. <div class="container two-columns <?php echo ( get_sub_field( 'is_first_element' ) ) ? 'is-first-element' : ''; ?>"
  192. id="b<?php echo $block_counter; ?>">
  193. <div class="row">
  194. <div class="offset-md-1 col-md-4 column-1">
  195. <?php the_sub_field( 'column_1' ); ?>
  196. </div>
  197. <div class="col-md-7 column-2">
  198. <?php the_sub_field( 'column_2' ); ?>
  199. </div>
  200. </div>
  201. </div>
  202. <!-- End content -->
  203. <?php
  204. elseif ( get_row_layout() == 'info_slider' ):
  205. $arr_color = get_sub_field_object( 'is_arrow-color' );
  206. $slider_color_class;
  207. if ( $arr_color['value'] == 'w' ) {
  208. $slider_color_class = "white";
  209. } else {
  210. $slider_color_class = "red";
  211. }
  212. ?>
  213. <!-- Start alternating columns -->
  214. <div class="slider-outer-wrap <?php echo $slider_color_class; ?>">
  215. <div class="container custom-slider-container" id="b<?php echo $block_counter; ?>">
  216. <?php
  217. $countSignInItems = 0;
  218. $slides = get_sub_field( 'is_slide-selector' );
  219. ?>
  220. <div class="col-12 custom-slider">
  221. <?php
  222. if ( $slides ):
  223. foreach ( $slides as $slide ):
  224. $curProjID = $slide;
  225. if ( get_field( 'headline', $curProjID ) || get_field( 'box', $curProjID ) || get_field( 'box_link', $curProjID ) || get_field( 'text', $curProjID ) || get_field( 'download_details_link', $curProjID ) || get_field( 'image', $curProjID ) || get_field( 'review', $curProjID ) || get_field( 'review_person', $curProjID ) || get_field( 'review_person_image', $curProjID ) ):
  226. $countSignInItems ++;
  227. if ( count( $slides ) > 1 ) {
  228. $item_style;
  229. if ( $countSignInItems == 1 ) {
  230. $item_style = "display: block;";
  231. } else {
  232. $item_style = "display: none;";
  233. }
  234. }
  235. ?>
  236. <div class="slide-item content i<?php echo $countSignInItems; ?>"
  237. style="<?php echo $item_style; ?>">
  238. <div class="row first-content">
  239. <div class="col-lg-8 col-12 order-last order-lg-first">
  240. <div class="heading">
  241. <h2>
  242. <?php the_field( 'headline', $curProjID ); ?>
  243. </h2>
  244. </div>
  245. <div class="text">
  246. <?php the_field( 'text', $curProjID ); ?>
  247. </div>
  248. <div class="red-box">
  249. <div class="subtext">
  250. <?php the_field( 'box', $curProjID ); ?>
  251. <?php if ( get_field( 'box_link', $curProjID ) ): ?>
  252. <a href="<?php the_field( 'box_link', $curProjID ); ?>"
  253. title="<?php esc_html_e( 'Mehr erfahren', 'more' ); ?>"><?php esc_html_e( 'Mehr erfahren', 'more' ); ?></a>
  254. <?php endif; ?>
  255. </div>
  256. </div>
  257. </div>
  258. <div class="col-lg-4 col-12 order-first order-lg-last">
  259. <div class="img-wrap">
  260. <?php
  261. $image = get_field( 'image', $curProjID );
  262. $imageID = $image['ID'];
  263. echo wp_get_attachment_image( $imageID, 'slider_image', false );
  264. ?>
  265. </div>
  266. </div>
  267. </div>
  268. <?php if ( get_field( 'review_person_image', $curProjID ) || get_field( 'review', $curProjID ) || get_field( 'review_person', $curProjID ) ): ?>
  269. <div class="row second-content">
  270. <div class="col-lg-2 offset-lg-1 offset-3 col-6">
  271. <div class="img-wrap">
  272. <?php
  273. $imagePerson = get_field( 'review_person_image', $curProjID );
  274. $imagePersonID = $imagePerson['ID'];
  275. echo wp_get_attachment_image( $imagePersonID, 'large', false );
  276. ?>
  277. </div>
  278. </div>
  279. <div class="offset-lg-0 col-lg-9 col-10 offset-1">
  280. <div class="quote-wrap">
  281. <div class="quote">
  282. <?php the_field( 'review', $curProjID ); ?>
  283. </div>
  284. <div class="quotee">
  285. <?php the_field( 'review_person', $curProjID ); ?>
  286. </div>
  287. </div>
  288. </div>
  289. </div>
  290. <?php endif; ?>
  291. </div>
  292. <?php
  293. endif;
  294. endforeach;
  295. endif;
  296. if ( $countSignInItems > 1 ) {
  297. if ( $arr_color['value'] == 'w' ) {
  298. ?>
  299. <a href="#" title="" onclick="return false;" class="slide-next">
  300. <img class="tooltip-graphic"
  301. src="<?php bloginfo( 'template_directory' ); ?>/assets/images/next-button-sg.svg"
  302. alt=""/>
  303. </a>
  304. <a href="#" title="" onclick="return false;" class="slide-previous">
  305. <img class="tooltip-graphic"
  306. src="<?php bloginfo( 'template_directory' ); ?>/assets/images/previous-button-sg.svg"
  307. alt=""/>
  308. </a>
  309. <?php
  310. } else {
  311. ?>
  312. <a href="#" title="" onclick="return false;" class="slide-next">
  313. <img class="tooltip-graphic"
  314. src="<?php bloginfo( 'template_directory' ); ?>/assets/images/next-button-b.svg"
  315. alt=""/>
  316. </a>
  317. <a href="#" title="" onclick="return false;" class="slide-previous">
  318. <img class="tooltip-graphic"
  319. src="<?php bloginfo( 'template_directory' ); ?>/assets/images/previous-button-b.svg"
  320. alt=""/>
  321. </a>
  322. <?php
  323. }
  324. }
  325. ?>
  326. <div class="slide-indicators">
  327. <ul>
  328. <?php $countSignInItems = 0;
  329. while ( have_rows( 'images_right' ) ) : the_row();
  330. $countSignInItems ++; ?>
  331. <li class="i<?php echo $countSignInItems; ?>">
  332. </li>
  333. <?php endwhile; ?>
  334. </ul>
  335. </div>
  336. </div>
  337. </div>
  338. </div>
  339. <!-- End content -->
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement