PageRenderTime 25ms CodeModel.GetById 16ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

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