homepage Welcome to WebmasterWorld Guest from 54.237.184.242
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / WordPress
Forum Library, Charter, Moderators: lorax & rogerd

WordPress Forum

    
Problem with creating a custom template
Tshot




msg:4596200
 8:09 pm on Jul 24, 2013 (gmt 0)

Hi Guys,

This is my first post here so I hope you are willing to help me. :).

For a customer i'm trying to create a custom template for a single Wordpress-page. The customer desires a single page with only the footer visible. I already found out how to hide the right sidebar and the menu and header, but the problem is that the stylesheet also disappears when i hide the header. Do you guys know how to fix this?

Thanks in advance!

Here's the code I used:
<?php
/*
Template Name: No Sidebar and No Header
*/
?>
<?php
/**
* The template for displaying all pages.
*
* This is the template that displays all pages by default.
* Please note that this is the WordPress construct of pages
* and that other 'pages' on your WordPress site will use a
* different template.
*
* @package WordPress
* @subpackage Twenty_Twelve
* @since Twenty Twelve 1.0
*/

//get_header(); ?>
<div id="contentwrapper">
<div id="contentcontainer">
<div id="content">
<?php while ( have_posts() ) : the_post(); ?>
<?php get_template_part( 'content', 'page' ); ?>
<?php endwhile; // end of the loop. ?>
</div>

<?php //get_sidebar(); ?>
<div class="clear"></div>

</div>
</div>
<?php get_footer(); ?>

 

lorax




msg:4596419
 1:19 pm on Jul 25, 2013 (gmt 0)

I haven't done this per se but from the Docs it seems an option would be to create a new header file and strip out all of the stuff you don't want. Make the filename header-styles.php and then call it in your template like so: get_header( 'styles' );

See: [codex.wordpress.org...]

Tshot




msg:4597182
 3:31 pm on Jul 28, 2013 (gmt 0)

Thanks lorax, this works perfect! I created a copy from header.php, called header-blanco.php. In this file I deleted some code (concerning menu, header image etc)

In the template file I changed this:

get_header(); ?>

into this:

get_header(blanco); ?>

That did the trick for me!

lorax




msg:4597238
 10:03 pm on Jul 28, 2013 (gmt 0)

Fabulous! Glad it worked.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / WordPress
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved