Advertisement
brooklyndesignstudio

Sticky Buttons on Side of Screen

Sep 19th, 2019
376
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.69 KB | None | 0 0
  1. // ADD TO BOTTOM OF FUNCTIONS.PHP
  2. // Show sticky app links for Apple and Google Play Stores
  3. add_action( 'wp_footer', 'show_google_apple_app_link_cbf',100 );
  4. function show_google_apple_app_link_cbf() {
  5.  
  6.     if(is_front_page() || is_home())return;
  7.  
  8.     $apple_link   = get_field('app_store_link');
  9.     $apple_image  = get_field('app_store_image');
  10.     $google_link  = get_field('google_store_link');
  11.     $google_image = get_field('google_store_image');
  12.  
  13.     if($apple_image){
  14.         $apple_image = $apple_image['url'];
  15.     }else{
  16.         $apple_image = wp_get_attachment_image_src(5177);
  17.         $apple_image = ($apple_image)? $apple_image[0] : '';
  18.     }
  19.     if($google_image){
  20.         $google_image = $google_image['url'];
  21.     }else{
  22.         $google_image = wp_get_attachment_image_src(5190);
  23.         $google_image = ($google_image)? $google_image[0] : '';
  24.     }
  25.  
  26.     //
  27.     if($apple_link){
  28.     ?>
  29.     <div id="apple-sticky-button">
  30.         <a href="<?php echo $apple_link; ?>" target="_blank">
  31.             <img src="<?php echo $apple_image; ?>" alt="Apple">
  32.         </a>
  33.     </div>
  34.     <?php
  35.     }
  36.     //
  37.     if($google_link){
  38.     ?>
  39.     <div id="google-sticky-button">
  40.         <a href="<?php echo $google_link; ?>">
  41.             <img src="<?php echo $google_image; ?>" alt="Google">
  42.         </a>
  43.     </div>
  44.     <?php
  45.     }
  46. }
  47.  
  48. // ADD TO CHILD THEME EDITOR STYLE.CSS
  49. /*----- [ STICKY BUTTONS FOR APPLE GOOGLE PLAY STORES ] -----*/
  50. #apple-sticky-button {
  51.    position: fixed;
  52.     right: -169px!important;
  53. /*  top: 392px; */
  54.     bottom: 236px;
  55.     width: 200px!important;
  56.     height: 25px!important;
  57.     z-index: 99999;  
  58. }
  59. #google-sticky-button {
  60.    position: fixed;
  61.     right: -170px!important;
  62. /*    top: 510px; */
  63.     bottom: 120px;
  64.     width: 200px!important;
  65.     height: 25px!important;
  66.     z-index: 99999;    
  67. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement