Implement header and footer in post-template?
-
Hey guys!
I want to implement the content of header.php and footer.php in a post-template. The reason for doing this is because i have to create a some posts, without the the navigation and footer, but i realized that i need some of the code from those two in order to load the post-page with the right stylesheets etc.
I tried to do it, and almost with success, however it still seems that i miss something (i suspect the stylesheet url to be the problem.
here is my code for the post-template including the code from the <head> and (i think) the correct end divs.
<!DOCTYPE html> <html <?php language_attributes(); ?>> <head> <meta charset="<?php bloginfo( 'charset' ); ?>" /> <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1" /> <link rel="stylesheet" type="text/css" media="all" href="<?php echo get_stylesheet_uri(); ?>" /> <link href='http://fonts.googleapis.com/css?family=Lato' rel='stylesheet' type='text/css'> <link href='http://fonts.googleapis.com/css?family=Rokkitt:700' rel='stylesheet' type='text/css'> <?php $blogTitle = get_bloginfo('name'); ?> <title><?php wp_title('·', true, 'right'); ?></title> <link rel="profile" href="http://gmpg.org/xfn/11" /> <link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" /> <?php if(is_singular()) wp_enqueue_script('comment-reply', false, array(), false, true); ?> <?php wp_head(); ?> </head> <body <?php body_class('lt-480'); ?>> <div id="main-container"> <a id="mobile-menu" href="#menu"></a> <?php /** * The Template for displaying all single Portfolio posts. */ otw_pfl_scripts_styles(); /* include the necessary srctips and styles */ otw_pfl_filter_scripts_styles(); ?> <?php $style_width = ''; if( get_option( 'otw_pfl_content_width' ) ) { $style_width = 'style="width:'.get_option('otw_pfl_content_width').'px;"'; } ?> <div class="otw-row" <?php echo $style_width; ?>> <?php while ( have_posts() ) : the_post(); ?> <div class="otw-eighteen otw-columns"> <article id="post-<?php the_ID(); ?>" <?php post_class('otw-single-portfolio-item'); ?>> <?php if ( get_post_meta( $post->ID, 'otw_head_title_setting_pfl', true) != 1 ) { ?> <div class="entry-header"> <div id="pageTitle"><?php the_title(); ?></div> </div> <?php } ?> <!-- Portfolio Image Slider --> <?php $check_imgs = get_post_meta( $post->ID, 'custom_otw-portfolio-repeatable-image', true); if( !empty( $check_imgs[0] ) ) { //if(get_post_meta($post->ID, 'custom_otw-portfolio-repeatable-image', true) ){ ?> <div class="portfolio-gallery-wrapper"> <div class="flexslider" id="portfolio-gallery" style="margin-bottom:10px;"> <div class="flex-viewport" style="overflow: hidden; position: relative;"><ul class="slides" style="width: 100%; transition-duration: 0s; transform: translate3d(0px, 0px, 0px);"> <?php $post_meta_data = get_post_custom($post->ID); $custom_repeatable = unserialize($post_meta_data['custom_otw-portfolio-repeatable-image'][0]); foreach ($custom_repeatable as $custom_image) { $url = wp_get_attachment_image_src($custom_image, 'otw-porfolio-large'); echo '<li data-thumb="'.$url[0].'" style="width: 100%; float: left; display: block;"><img alt="" src="'.$url[0].'"></li>'; } ?> </ul></div><ul class="flex-direction-nav"><li><a href="#" class="flex-prev flex-disabled"><?php _e( 'Previous', 'otw_pfl' ); ?></a></li><li><a href="#" class="flex-next"><?php _e( 'Next', 'otw_pfl' ); ?></a></li></ul></div> <div class="flexslider" id="portfolio-carousel" style="margin-bottom:10px;"> <div class="flex-viewport" style="overflow: hidden; position: relative;"><ul class="slides" style="width: 100%; transition-duration: 0s; transform: translate3d(0px, 0px, 0px);"> <?php $post_meta_data = get_post_custom($post->ID); $custom_repeatable = unserialize($post_meta_data['custom_otw-portfolio-repeatable-image'][0]); foreach ($custom_repeatable as $custom_image) { $url = wp_get_attachment_image_src($custom_image, 'otw-porfolio-large'); echo '<li data-thumb="'.$url[0].'" style="width: 210px; float: left; display: block;"><img alt="" src="'.$url[0].'"></li>'; } ?> </ul></div><ul class="flex-direction-nav"><li><a href="#" class="flex-prev flex-disabled"><?php _e( 'Previous', 'otw_pfl' ); ?></a></li><li><a href="#" class="flex-next"><?php _e( 'Next', 'otw_pfl' ); ?></a></li></ul></div> </div> <div class="entry-content"> <?php the_content(); ?> <!-- Portfolio Meta Content --> <?php if(get_post_meta($post->ID, 'custom_otw-portfolio-url', true) ) { ?> <div class="visit-site"><a href="http://<?php echo get_post_meta($post->ID, 'custom_otw-portfolio-url', true); ?>"><?php _e( 'Visit site', 'otw_pfl' ); ?></a></div> <?php } ?> <?php if(get_post_meta($post->ID, 'custom_otw-portfolio-quote', true) ) { ?> <blockquote class="otw-sc-quote bordered"> <p><?php echo get_post_meta($post->ID, 'custom_otw-portfolio-quote', true); ?></p> </blockquote> <?php } ?> <!-- END Portfolio Meta Content --> <?php /*?><div class="categories"><?php the_taxonomies(); ?> <?php edit_post_link( __( 'Edit Post', 'otw_pfl' ), '<span class="edit-link">', '</span><br /><br />' ); ?></div><?php */?> </div> <?php } ?> <!-- END Portfolio Image Slider --> <nav class="nav-single"> <span class="nav-previous"><?php previous_post_link( '%link', '<span class="meta-nav">' . _x( '←', 'Previous post link', 'otw_pfl' ) . '</span> %title' ); ?></span> <span class="nav-next"><?php next_post_link( '%link', '%title <span class="meta-nav">' . _x( '→', 'Next post link', 'otw_pfl' ) . '</span>' ); ?></span> </nav><!-- .nav-single --> <?php // comments_template( '', true ); ?> </article><!-- #post --> </div> <?php endwhile; // end of the loop. ?> </div> </div><?php /* #main */ ?> </div><?php /* #page */ ?> </div><?php /* #page-wrap */ ?> </body> </html>can some of you tell me what might be wrong? For your information, my template is located in the plugin folder, and not in the themes folder as usual.
Thank you in advance
The topic ‘Implement header and footer in post-template?’ is closed to new replies.