/templates/demo/index.php

https://github.com/deltafactory/landing-pages · PHP · 145 lines · 103 code · 11 blank · 31 comment · 5 complexity · ec0107eb1cd60438037621f8f9599ad0 MD5 · raw file

  1. <?php
  2. /**
  3. * Template Name: Demo Template
  4. *
  5. * @package WordPress Landing Pages
  6. * @author David Wells
  7. * @link http://www.inboundnow.com
  8. * @version 1.0
  9. */
  10. /* Step 1: Declare Template Key. This will be automatically detected for you */
  11. $key = lp_get_parent_directory(dirname(__FILE__));
  12. $path = (preg_match("/uploads/", dirname(__FILE__))) ? LANDINGPAGES_UPLOADS_URLPATH . $key .'/' : LANDINGPAGES_URLPATH.'templates/'.$key.'/'; // This defines the path to your template folder. /wp-content/uploads/landing-pages/templates by default
  13. /* Define Landing Pages's custom pre-load hook for 3rd party plugin integration */
  14. do_action('lp_init');
  15. /* Load Regular WordPress $post data and start the loop */
  16. if (have_posts()) : while (have_posts()) : the_post();
  17. /**
  18. * Step 2: Pre-load meta data into variables.
  19. * - These are defined in this templates config.php file
  20. * - The config.php values create the metaboxes visible to the user.
  21. * - We define those meta-keys here to use them in the template.
  22. */
  23. // Text Field Label: Text field Description. Defined in config.php on line 44
  24. $text_box_id = lp_get_value($post, $key, 'text-box-id');
  25. // Textarea Label: Text field Description. Defined in config.php on line 50
  26. $textarea_id = lp_get_value($post, $key, 'textarea-id');
  27. // Template body color: Text field Description. Defined in config.php on line 56
  28. $color_picker_id = lp_get_value($post, $key, 'color-picker-id');
  29. // Radio Label: Text field Description. Defined in config.php on line 62
  30. $radio_id_here = lp_get_value($post, $key, 'radio-id-here');
  31. // Example Checkbox Label: Text field Description. Defined in config.php on line 70
  32. $checkbox_id_here = lp_get_value($post, $key, 'checkbox-id-here');
  33. // Dropdown Label: Text field Description. Defined in config.php on line 78
  34. $dropdown_id_here = lp_get_value($post, $key, 'dropdown-id-here');
  35. // Date Picker Label: Text field Description. Defined in config.php on line 85
  36. $date_picker = lp_get_value($post, $key, 'date-picker');
  37. // Main Content Box 2: Text field Description. Defined in config.php on line 91
  38. $wysiwyg_id = lp_get_value($post, $key, 'wysiwyg-id');
  39. // File/Image Upload Label: Text field Description. Defined in config.php on line 97
  40. $media_id = lp_get_value($post, $key, 'media-id');
  41. // The main content if you want to show default placeholders.
  42. $content = lp_get_value($post, $key, 'main-content');
  43. $conversion_area = lp_get_value($post, $key, 'conversion-area-content');
  44. // alternatively you can use default wordpress get_post_meta.
  45. // You will need to add your template $key to the meta id. Example "text-box-id" becomes "demo-text-box-id"
  46. // example: $text_box_id = get_post_meta($post->ID, 'demo-text-box-id', true);
  47. ?>
  48. <!DOCTYPE html>
  49. <!-- paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ -->
  50. <!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->
  51. <!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8" lang="en"> <![endif]-->
  52. <!--[if IE 8]> <html class="no-js lt-ie9" lang="en"> <![endif]-->
  53. <!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
  54. <head>
  55. <!-- Define page title -->
  56. <title><?php wp_title(); ?></title>
  57. <meta charset="utf-8" />
  58. <meta name="viewport" content="width=device-width" />
  59. <!-- Included CSS Files -->
  60. <link rel="stylesheet" href="<?php echo $path; ?>assets/css/style.css">
  61. <!-- Included JS Files -->
  62. <script src="<?php echo $path; ?>assets/js/modernizr.js"></script>
  63. <!-- Inline Style Block for implementing css changes based off user settings -->
  64. <style type="text/css">
  65. <?php
  66. // If color changed, apply new hex color
  67. if ($color_picker_id != "") {
  68. echo "body { background-color: #$color_picker_id;} ";
  69. }
  70. ?>
  71. </style>
  72. <!-- Load Normal WordPress wp_head() function -->
  73. <?php wp_head(); ?>
  74. <!-- Load Landing Pages's custom pre-load hook for 3rd party plugin integration -->
  75. <?php do_action('lp_head'); ?>
  76. </head>
  77. <!-- lp_body_class(); Defines Custom Body Classes for Advanced User CSS Customization -->
  78. <body <?php body_class(); ?>>
  79. <div id="wrapper">
  80. <!-- example of conditional statment -->
  81. <?php if ( $checkbox_id_here === "on" ) {
  82. // do something for Example Checkbox Label option
  83. }
  84. ?>
  85. <div id="content-wrapper">
  86. <div id="content">
  87. <!-- Use the_title(); to print out the main headline -->
  88. <h1><?php the_title(); ?></h1>
  89. <?php echo do_shortcode( $content ); ?>
  90. <div id="demo-hide">
  91. <!-- Echoed out values from the metaboxes from config.php -->
  92. <?php echo "Here is the Text Box content:" . $text_box_id . "<br>";
  93. echo "Here is the Textarea content:" . $textarea_id . "<br>";
  94. echo "Here is the Color Picker Hex:" . $color_picker_id . "<br>";
  95. echo "Here is the Radio Value:" . $radio_id_here . "<br>";
  96. echo "Here is the Checkbox Value:" . $checkbox_id_here . "<br>";
  97. echo "Here is the Dropdown Value:" . $dropdown_id_here . "<br>";
  98. echo "Here is the Date Picker Value:" . $date_picker . "<br>";
  99. echo "Here is the WYSIWYG editor content:" . $wysiwyg_id . "<br>";
  100. echo "Here is the Media upload path:" . $media_id; ?>
  101. </div>
  102. </div>
  103. <div id="sidebar">
  104. <br><br>
  105. <div id="form-area">
  106. <b>Conversion Area Content</b>
  107. <?php echo do_shortcode( $conversion_area ); // Print out conversion area metabox content ?>
  108. </div>
  109. </div>
  110. </div>
  111. <?php
  112. break;
  113. endwhile; endif;
  114. do_action('lp_footer'); // Load custom landing footer hook for 3rd party extensions
  115. wp_footer(); // Load normal wordpress footer
  116. ?>
  117. </body>
  118. </html>