Advertisement
mgarza

Add Meta Slider to DevDmBootstrap3 Theme

Feb 8th, 2017
34
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.06 KB | None | 0 0
  1. Meta Slider template include:
  2. Copy & paste this code into a template file to include the slideshow within your theme.
  3.  
  4. <?php
  5. echo do_shortcode("[metaslider id=20345]");
  6. ?>
  7.  
  8. Current template-part-head.php code:
  9.  
  10. <?php global $dm_settings; ?>
  11.  
  12. <div class="container dmbs-container">
  13.  
  14. <?php if ($dm_settings['show_header'] != 0) : ?>
  15.  
  16. <div class="row dmbs-header">
  17.  
  18. <?php get_template_part('template-part', 'topnav'); ?>
  19. <a id="logo" href="<?php echo esc_url( home_url( '/' ) ); ?>"><img src="http://mypapernet.com/wp-content/uploads/logo.jpg" /></a>
  20. <div id="search"><?php get_search_form(); ?></div>
  21. <div id="publications"><img src="/wp-content/uploads/publications.jpg"/>
  22. <div id="publicationsdropdown">
  23. <a href="http://mypapernet.com/wp-content/themes/ocalacoupons.com/images/oct2016opn/index.html" target="_blank">Ocala Paper Net</a>
  24. <a href="http://mypapernet.com/wp-content/themes/ocalacoupons.com/images/sep2016vpn/index.html" target="_blank">The Villages Paper Net</a>
  25. <a href="http://mypapernet.com/wp-content/themes/ocalacoupons.com/images/sep2016ocm/index.html" target="_blank">Ocala Coupon Magazine</a>
  26. </div>
  27. </div>
  28.  
  29. <div id="app">
  30. <a href="https://itunes.apple.com/us/app/ocala-coupons/id994912773?mt=8"><img src="http://mypapernet.com/wp-content/uploads/appstore-e1438196026362.png" /></a>
  31. <a href="https://play.google.com/store/apps/details?id=hr.apps.n206949039"><img src="http://mypapernet.com/wp-content/uploads/googleplay-e1438196334724.png" /></a>
  32. </div>
  33. <div id="social">
  34. <a href="https://www.facebook.com/PaperNetMagazine"><img src="http://mypapernet.com/wp-content/uploads/fb.jpg" /></a>
  35. <a href="https://twitter.com/ThePaperNet"><img src="http://mypapernet.com/wp-content/uploads/twitter.jpg" /></a>
  36.  
  37. </div>
  38. </div>
  39. <div id="adrotator">
  40. <div id="rotator">
  41. <?php
  42. if (is_single()) { ?>
  43. <?php $postid = get_the_ID();
  44. $metaimg = array();
  45. for ($i = 1; $i < 10; $i++) {
  46. if (get_post_meta($postid,'img'.$i,true) != '') {
  47. $metaimg[$i] = get_post_meta($postid,'img'.$i,true);
  48. } else {
  49. break;
  50. }
  51. }
  52. foreach ($metaimg as $key => $img) { ?>
  53. <div id="img<?php echo $key; ?>" class="slide"><img src="<?php echo $img; ?>" /></div>
  54. <?php }
  55. } else {
  56. if(is_category()){
  57. $cats = category_description();
  58. $cats = str_replace(array('<p>','</p>'),'',$cats);
  59. $categoriesarr = explode('<br />',$cats);
  60. $imgn = 1;
  61. foreach ($categoriesarr as $src) {
  62. echo '<div id="img'.$imgn.'" class="slide"><img src="'.$src.'" /></div>';
  63. $imgn++;
  64. }
  65. } else {
  66. ?>
  67. <div id="img1" class="slide"><img src="http://mypapernet.com/wp-content/themes/ocalacoupons.com/images/lees2.jpg" /></div>
  68. <div id="img2" class="slide"><A HREF="http://worldcorprealtyllc.com/" target="_blank"><img src="http://mypapernet.com/wp-content/uploads/worldcorpbanner11717.jpg" /></a></div>
  69. <div id="img3" class="slide"><img src="http://mypapernet.com/wp-content/uploads/sonic.jpg" /></div>
  70. <div id="img4" class="slide"> <A HREF="/subscribe" target="_blank"><img src="http://mypapernet.com/wp-content/uploads/pals.jpg" /></a></div>
  71.  
  72. <?php } } ?>
  73. </div><br>
  74. <div id="thumbwrap"><div id="thumbs"></div></div>
  75.  
  76. </div>
  77. <div id="homeboxes">
  78. <a href="/category/restaurants"><img src="http://mypapernet.com/wp-content/themes/ocalacoupons.com/images/restaurants.jpg" /></a>
  79. <a href="/category/home-improvement"><img src="http://mypapernet.com/wp-content/themes/ocalacoupons.com/images/home.jpg" /></a>
  80. <a href="/category/services"><img src="http://mypapernet.com/wp-content/themes/ocalacoupons.com/images/services.jpg" /></a>
  81. <a href="/category/auto"><img src="http://mypapernet.com/wp-content/themes/ocalacoupons.com/images/auto.jpg" /></a>
  82. <a href="/category/health"><img src="http://mypapernet.com/wp-content/themes/ocalacoupons.com/images/health.jpg" /></a>
  83. <a href="/category/beauty"><img src="http://mypapernet.com/wp-content/themes/ocalacoupons.com/images/beauty.jpg" /></a>
  84. <a href="/category/entertainment"><img src="http://mypapernet.com/wp-content/uploads/retail-1.jpg" /></a>
  85. </div>
  86. <div id="dropdown">
  87. <div id="categories">
  88. <?php wp_dropdown_categories('show_option_none=Select category');?>
  89. <script type="text/javascript">
  90.  
  91. <!--
  92. var dropdown = document.getElementById("cat");
  93. function onCatChange() {
  94. if ( dropdown.options[dropdown.selectedIndex].value > 0 ) {
  95. location.href = "<?php echo esc_url( home_url( '/' ) ); ?>?cat="+dropdown.options[dropdown.selectedIndex].value;
  96. }
  97. }
  98. dropdown.onchange = onCatChange;
  99. -->
  100. wp_list_categories();
  101. </script>
  102.  
  103. </div>
  104. </div>
  105.  
  106. <?php endif; ?>
  107. <script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
  108.  
  109. <script type="text/javascript" language="javascript">
  110. jQuery(document).ready(function() {
  111.  
  112. $('#publications').hover(
  113. function () {
  114. $('#publicationsdropdown').show();
  115. },
  116. function () {
  117. $('#publicationsdropdown').hide();
  118. }
  119. );
  120.  
  121. var img = 1;
  122. var hovering = 0;
  123. for (i=1;i<=$('#rotator > div').length;i++) {
  124. $('#thumbs').append('<div id="thumb'+i+'" class="thumb"></div>');
  125. }
  126. jQuery('#img'+img).show();
  127. jQuery('#thumb'+img).addClass('active');
  128. setInterval(function() {
  129. if (!hovering) {
  130. jQuery('#img'+img).hide();
  131. jQuery('.active').removeClass('active');
  132. if (img < $('#rotator > div').length) {
  133. img++;
  134. } else {
  135. img = 1;
  136. }
  137. jQuery('#img'+img).show();
  138. jQuery('#thumb'+img).addClass('active');
  139. }
  140. }, 3000);
  141. jQuery("#thumbs .thumb").hover(
  142. function () {
  143. jQuery('.active').removeClass('active');
  144. hovering = 1;
  145. jQuery('#img'+img).hide();
  146. img = jQuery(this).attr('id').substr(5);
  147. jQuery('#img'+img).show();
  148. jQuery('#thumb'+img).addClass('active');
  149. },
  150. function () {
  151. hovering = 0;
  152. }
  153. );
  154. $('#img1').show();
  155.  
  156. $('#searchsubmit').val('');
  157. $('#testimonial1').show();
  158. var t = 0;
  159. setInterval(function() {
  160. jQuery('#testimonial'+t).hide();
  161. if (t < $('#testimonials > div').length) {
  162. t++;
  163. } else {
  164. t = 1;
  165. }
  166. jQuery('#testimonial'+t).show();
  167. }, 5000);
  168. });
  169. </script>
  170. <script type="text/javascript" src="https://s3.amazonaws.com/kanta/popup_scripts/toapp.js"></script>
  171. <link href="https://s3.amazonaws.com/kanta/popup_scripts/toapp.css" rel="stylesheet" type="text/css" />
  172. <script type="text/javascript">
  173. ToApp.init({
  174. variations: {
  175. iphone: {
  176. title: "'Ocala Coupons' has an app! Would you like to install it?",
  177. url: "https://itunes.apple.com/us/app/ocala-coupons/id994912773?ls=1&mt=8"
  178. },
  179. android: {
  180. title: "'Ocala Coupons' has an app! Would you like to install it?",
  181. url: "https://play.google.com/store/apps/details?id=hr.apps.n206949039"
  182. }
  183. },
  184. choice: "prompt"
  185. });
  186. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement