PageRenderTime 259ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

/wp-content/themes/bladencountyrecords/inc/roots-actions.php

https://gitlab.com/blueprintmrk/bladencountyrecords
PHP | 297 lines | 270 code | 27 blank | 0 comment | 29 complexity | a7aea782fbf8b6c75740b7ef81e4c7da MD5 | raw file
  1. <?php
  2. add_action('roots_head', 'roots_google_analytics');
  3. add_action('roots_head', 'roots_fout_b_gone');
  4. add_action('roots_head', 'roots_1140_head');
  5. add_action('roots_head', 'roots_adapt_head');
  6. add_action('roots_head', 'roots_foundation_head');
  7. add_action('roots_head', 'roots_bootstrap_head');
  8. add_action('roots_stylesheets', 'roots_get_stylesheets');
  9. add_action('roots_header_before', 'roots_1140_header_before');
  10. add_action('roots_header_after', 'roots_1140_header_after');
  11. add_action('roots_footer_before', 'roots_1140_footer_before');
  12. add_action('roots_footer_after', 'roots_1140_footer_after');
  13. add_action('roots_header_before', 'roots_bootstrap_header_before');
  14. add_action('roots_header_after', 'roots_bootstrap_header_after');
  15. add_action('roots_footer_before', 'roots_bootstrap_footer_before');
  16. add_action('roots_footer_after', 'roots_bootstrap_footer_after');
  17. add_action('roots_post_inside_before', 'roots_page_breadcrumb');
  18. function roots_google_analytics() {
  19. global $roots_options;
  20. $roots_google_analytics_id = $roots_options['google_analytics_id'];
  21. $get_roots_google_analytics_id = esc_attr($roots_options['google_analytics_id']);
  22. if ($roots_google_analytics_id !== '') {
  23. echo "\n\t<script>\n";
  24. echo "\t\tvar _gaq=[['_setAccount','$get_roots_google_analytics_id'],['_trackPageview'],['_trackPageLoadTime']];\n";
  25. echo "\t\t(function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];\n";
  26. echo "\t\tg.src=('https:'==location.protocol?'//ssl':'//www')+'.google-analytics.com/ga.js';\n";
  27. echo "\t\ts.parentNode.insertBefore(g,s)}(document,'script'));\n";
  28. echo "\t</script>\n";
  29. }
  30. }
  31. function roots_fout_b_gone() {
  32. global $roots_options;
  33. $roots_fout_b_gone = $roots_options['fout_b_gone'];
  34. $template_uri = get_template_directory_uri();
  35. if ($roots_fout_b_gone === true) {
  36. echo "\t<script src=\"$template_uri/js/libs/foutbgone.min.js\"></script>\n";
  37. echo "\t<script>\n";
  38. echo "\t\tfbg.hideFOUT('asap', 100);\n";
  39. echo "\t</script>";
  40. }
  41. }
  42. function roots_1140_head() {
  43. global $roots_options;
  44. $roots_css_framework = $roots_options['css_framework'];
  45. $template_uri = get_template_directory_uri();
  46. if ($roots_css_framework === '1140') {
  47. echo "\t<script src=\"$template_uri/js/libs/css3-mediaqueries.js\"></script>";
  48. }
  49. }
  50. function roots_adapt_head() {
  51. global $roots_options;
  52. $roots_css_framework = $roots_options['css_framework'];
  53. $template_uri = get_template_directory_uri();
  54. if ($roots_css_framework === 'adapt') {
  55. echo "\n\t<script>\n";
  56. echo "\t\tvar ADAPT_CONFIG = {\n";
  57. echo "\t\t\tpath: '$template_uri/css/adapt/',\n";
  58. echo "\t\t\tdynamic: true,\n";
  59. echo "\t\t\trange: [\n";
  60. echo "\t\t\t\t'0px to 760px = mobile.css',\n";
  61. echo "\t\t\t\t'760px to 980px = 720.css',\n";
  62. echo "\t\t\t\t'980px to 1280px = 960.css',\n";
  63. echo "\t\t\t\t'1280px to 1600px = 1200.css',\n";
  64. echo "\t\t\t\t'1600px to 1920px = 1560.css',\n";
  65. echo "\t\t\t\t'1920px = fluid.css'\n";
  66. echo "\t\t\t]\n";
  67. echo "\t\t};\n";
  68. echo "\t</script>\n";
  69. echo "\t<script src=\"$template_uri/js/libs/adapt.min.js\"></script>";
  70. }
  71. }
  72. function roots_foundation_head() {
  73. global $roots_options;
  74. $roots_css_framework = $roots_options['css_framework'];
  75. $template_uri = get_template_directory_uri();
  76. if ($roots_css_framework === 'foundation') {
  77. echo "\t<!-- Combine and Compress These Javascript Files -->\n";
  78. echo "\t<script src=\"$template_uri/js/foundation/jquery.reveal.js\"></script>\n";
  79. echo "\t<script src=\"$template_uri/js/foundation/jquery.orbit-1.3.0.js\"></script>\n";
  80. echo "\t<script src=\"$template_uri/js/foundation/forms.jquery.js\"></script>\n";
  81. echo "\t<script src=\"$template_uri/js/foundation/jquery.customforms.js\"></script>\n";
  82. echo "\t<script src=\"$template_uri/js/foundation/jquery.placeholder.min.js\"></script>\n";
  83. echo "\t<!-- End Combine and Compress Javascript Files -->\n";
  84. echo "\t<script src=\"$template_uri/js/foundation/app.js\"></script>\n";
  85. echo "\t<!-- IE Fix for HTML 5 Tags -->\n";
  86. echo "\t<!--[if lt IE 9]>\n";
  87. echo "\t\t<script src=\"http://html5shiv.googlecode.com/svn/trunk/html5.js\"></script>\n";
  88. echo "\t<![endif]-->\n";
  89. }
  90. }
  91. function roots_bootstrap_head() {
  92. global $roots_options;
  93. $roots_css_framework = $roots_options['css_framework'];
  94. $roots_bootstrap_js = $roots_options['bootstrap_javascript'];
  95. $roots_bootstrap_less_js = $roots_options['bootstrap_less_javascript'];
  96. $template_uri = get_template_directory_uri();
  97. if ($roots_css_framework === 'bootstrap_less') {
  98. echo "\t<script src=\"$template_uri/js/bootstrap/less-1.1.3.min.js\"></script>\n";
  99. }
  100. if ($roots_bootstrap_js === true) {
  101. $roots_options['bootstrap_less_javascript'] = false;
  102. echo "\t<script src=\"$template_uri/js/bootstrap/bootstrap-modal.js\"></script>\n";
  103. echo "\t<script src=\"$template_uri/js/bootstrap/bootstrap-alerts.js\"></script>\n";
  104. echo "\t<script src=\"$template_uri/js/bootstrap/bootstrap-twipsy.js\"></script>\n";
  105. echo "\t<script src=\"$template_uri/js/bootstrap/bootstrap-popover.js\"></script>\n";
  106. echo "\t<script src=\"$template_uri/js/bootstrap/bootstrap-dropdown.js\"></script>\n";
  107. echo "\t<script src=\"$template_uri/js/bootstrap/bootstrap-scrollspy.js\"></script>\n";
  108. echo "\t<script src=\"$template_uri/js/bootstrap/bootstrap-tabs.js\"></script>\n";
  109. echo "\t<script src=\"$template_uri/js/bootstrap/bootstrap-buttons.js\"></script>\n";
  110. }
  111. if ($roots_bootstrap_less_js === true) {
  112. $roots_options['bootstrap_javascript'] = false;
  113. echo "\t<script src=\"$template_uri/js/bootstrap/bootstrap-modal.js\"></script>\n";
  114. echo "\t<script src=\"$template_uri/js/bootstrap/bootstrap-alerts.js\"></script>\n";
  115. echo "\t<script src=\"$template_uri/js/bootstrap/bootstrap-twipsy.js\"></script>\n";
  116. echo "\t<script src=\"$template_uri/js/bootstrap/bootstrap-popover.js\"></script>\n";
  117. echo "\t<script src=\"$template_uri/js/bootstrap/bootstrap-dropdown.js\"></script>\n";
  118. echo "\t<script src=\"$template_uri/js/bootstrap/bootstrap-scrollspy.js\"></script>\n";
  119. echo "\t<script src=\"$template_uri/js/bootstrap/bootstrap-tabs.js\"></script>\n";
  120. echo "\t<script src=\"$template_uri/js/bootstrap/bootstrap-buttons.js\"></script>\n";
  121. }
  122. }
  123. function roots_get_stylesheets() {
  124. global $roots_options;
  125. $roots_css_framework = $roots_options['css_framework'];
  126. $styles = '';
  127. switch ($roots_css_framework) {
  128. case 'blueprint' :
  129. $styles .= stylesheet_link_tag('/blueprint/screen.css');
  130. break;
  131. case '960gs_12' :
  132. case '960gs_16' :
  133. $styles .= stylesheet_link_tag('/960/reset.css');
  134. $styles .= stylesheet_link_tag('/960/text.css', 1);
  135. $styles .= stylesheet_link_tag('/960/960.css', 1);
  136. break;
  137. case '960gs_24' :
  138. $styles .= stylesheet_link_tag('/960/reset.css');
  139. $styles .= stylesheet_link_tag('/960/text.css', 1);
  140. $styles .= stylesheet_link_tag('/960/960_24_col.css', 1);
  141. break;
  142. case '1140' :
  143. $styles .= stylesheet_link_tag('/1140/1140.css');
  144. break;
  145. case 'adapt' :
  146. $styles .= stylesheet_link_tag('/adapt/master.css');
  147. $styles .= "\t<noscript>\n";
  148. $styles .= stylesheet_link_tag('/adapt/mobile.css', 1);
  149. $styles .= "\t</noscript>\n";
  150. break;
  151. case 'foundation' :
  152. $styles .= stylesheet_link_tag('/foundation/globals.css');
  153. $styles .= stylesheet_link_tag('/foundation/typography.css', 1);
  154. $styles .= stylesheet_link_tag('/foundation/grid.css', 1);
  155. $styles .= stylesheet_link_tag('/foundation/ui.css', 1);
  156. $styles .= stylesheet_link_tag('/foundation/forms.css', 1);
  157. $styles .= stylesheet_link_tag('/foundation/orbit.css', 1);
  158. $styles .= stylesheet_link_tag('/foundation/reveal.css', 1);
  159. $styles .= stylesheet_link_tag('/foundation/mobile.css', 1);
  160. $styles .= stylesheet_link_tag('/foundation/app.css', 1);
  161. break;
  162. case 'less' :
  163. $styles .= stylesheet_link_tag('/less/less.css');
  164. break;
  165. case 'bootstrap' :
  166. $styles .= stylesheet_link_tag('/bootstrap/bootstrap.css');
  167. break;
  168. case 'bootstrap_less' :
  169. $styles .= stylesheet_link_tag_boostrap_less('/bootstrap/lib/bootstrap.less');
  170. break;
  171. }
  172. if (class_exists('RGForms')) {
  173. $styles .= "\t<link rel=\"stylesheet\" href=\"" . plugins_url(). "/gravityforms/css/forms.css\">\n";
  174. }
  175. if (is_child_theme()) {
  176. $styles .= stylesheet_link_tag('/style.css', 1);
  177. $styles .= "\t<link rel=\"stylesheet\" href=\"" . get_stylesheet_uri(). "\">\n";
  178. } else {
  179. $styles .= stylesheet_link_tag('/style.css', 1);
  180. }
  181. switch ($roots_css_framework) {
  182. case 'blueprint' :
  183. $styles .= "\t<!--[if lt IE 8]>" . stylesheet_link_tag('/blueprint/ie.css', 0, false) . "<![endif]-->\n";
  184. break;
  185. case '1140' :
  186. $styles .= "\t<!--[if lt IE 8]>" . stylesheet_link_tag('/1140/ie.css', 0, false) . "<![endif]-->\n";
  187. break;
  188. case 'foundation' :
  189. $styles .= "\t<!--[if lt IE 9]>" . stylesheet_link_tag('/foundation/ie.css', 0, false) . "<![endif]-->\n";
  190. break;
  191. }
  192. echo $styles;
  193. }
  194. function stylesheet_link_tag($file, $tabs = 0, $newline = true) {
  195. $indent = str_repeat("\t", $tabs);
  196. return $indent . '<link rel="stylesheet" href="' . get_template_directory_uri() . '/css' . $file . '">' . ($newline ? "\n" : "");
  197. }
  198. function stylesheet_link_tag_boostrap_less($file, $tabs = 0, $newline = true) {
  199. $indent = str_repeat("\t", $tabs);
  200. return $indent . '<link rel="stylesheet/less" media="all" href="' . get_template_directory_uri() . '/css' . $file . '">' . ($newline ? "\n" : "");
  201. }
  202. function roots_1140_header_before() {
  203. global $roots_options;
  204. $roots_css_framework = $roots_options['css_framework'];
  205. if ($roots_css_framework === '1140') {
  206. echo '<div class="container"><div class="row">', "\n";
  207. }
  208. }
  209. function roots_1140_header_after() {
  210. global $roots_options;
  211. $roots_css_framework = $roots_options['css_framework'];
  212. if ($roots_css_framework === '1140') {
  213. echo "</div></div><!-- /.row /.container -->\n";
  214. echo '<div class="container"><div class="row">', "\n";
  215. }
  216. }
  217. function roots_1140_footer_before() {
  218. global $roots_options;
  219. $roots_css_framework = $roots_options['css_framework'];
  220. if ($roots_css_framework === '1140') {
  221. echo "</div></div><!-- /.row /.container -->\n";
  222. echo '<div class="container"><div class="row">', "\n";
  223. }
  224. }
  225. function roots_1140_footer_after() {
  226. global $roots_options;
  227. $roots_css_framework = $roots_options['css_framework'];
  228. if ($roots_css_framework === '1140') {
  229. echo "</div></div><!-- /.row /.container -->\n";
  230. }
  231. }
  232. function roots_bootstrap_header_before() {
  233. global $roots_options;
  234. $roots_css_framework = $roots_options['css_framework'];
  235. if ($roots_css_framework === 'bootstrap' || $roots_css_framework === 'bootstrap_less') {
  236. echo '<div class="container">', "\n";
  237. }
  238. }
  239. function roots_bootstrap_header_after() {
  240. global $roots_options;
  241. $roots_css_framework = $roots_options['css_framework'];
  242. if ($roots_css_framework === 'bootstrap' || $roots_css_framework === 'bootstrap_less') {
  243. echo "</div><!-- /.container -->\n";
  244. echo '<div class="container">', "\n";
  245. }
  246. }
  247. function roots_bootstrap_footer_before() {
  248. global $roots_options;
  249. $roots_css_framework = $roots_options['css_framework'];
  250. if ($roots_css_framework === 'bootstrap' || $roots_css_framework === 'bootstrap_less') {
  251. echo "</div><!-- /.container -->\n";
  252. echo '<div class="container">', "\n";
  253. }
  254. }
  255. function roots_bootstrap_footer_after() {
  256. global $roots_options;
  257. $roots_css_framework = $roots_options['css_framework'];
  258. if ($roots_css_framework === 'bootstrap' || $roots_css_framework === 'bootstrap_less') {
  259. echo "</div><!-- /.container -->\n";
  260. }
  261. }
  262. function roots_page_breadcrumb() {
  263. global $post;
  264. if (function_exists('yoast_breadcrumb')) {
  265. if (is_page() && $post->post_parent) {
  266. yoast_breadcrumb('<p id="breadcrumbs">','</p>');
  267. }
  268. }
  269. }
  270. ?>