Solved

WordPress page without header

Posted on 2012-04-10
10
1,098 Views
Last Modified: 2012-06-22
Hello experts,
Been looking everywhere for this solution, I hope someone here can help me out.

Background:
Currently our company blog is hosted with Hubspot.com under a subdomain of our tld (blog.mydomain.com).
Our main site is self hosted and running on Drupal (main.mydomain.com)  
Our current blog can be access one of two ways; blog.mydomain.com or main.mydomain.com/media/blog. The latter displays the blog in a iframe in order for it to look like its native to the site.

I have recently built a new blog called news.mydomain.com with WordPress.

To satisfy the requirements to allow me to move from Hubspot to WP is that I need to be able to bring the WP site into the main site without the header and footer.  Just the body of the WP site with the sidebars and updated posts.

Because of the this particular custom install of Drupal, any folder I add to the subdomain, main.mydomain.com, is not accessable via web browser.  I am forced to use a iframe. Yes, I know search engines ignore iframes.

I tried this plugin; "Just the Page" and its perfect.  But it does exactly what it is says, everything is stripped out.  If I could add the body, css, posts and side bar I would be out of the woods and add that page to the iFrame.  But the code to make that happen escapes me.

Thanks in advance
Richard
0
Comment
Question by:ezrhino5151
  • 5
  • 4
10 Comments
 
LVL 70

Accepted Solution

by:
Jason C. Levine earned 400 total points
ID: 37830235
You can do this by editing the theme files and removing the calls to the header and footer.  For example, here is a Custom Page Template I created for TwentyTen that strips out the header and footer.  However, it was a one-column page to start with so the sidebar is also removed:

<?php
/**
 * Template Name: One column, no sidebar, no header, no footer
 *
 * A custom page template without sidebar.
 *
 * The "Template Name:" bit above allows this to be selectable
 * from a dropdown menu on the edit page screen.
 *
 * @package WordPress
 * @subpackage Twenty_Ten
 * @since Twenty Ten 1.0
 */

//get_header(); ?>

		<div id="container" class="one-column">
			<div id="content" role="main">

			<?php
			/* Run the loop to output the page.
			 * If you want to overload this in a child theme then include a file
			 * called loop-page.php and that will be used instead.
			 */
			 get_template_part( 'loop', 'page' );
			?>

			</div><!-- #content -->
		</div><!-- #container -->

<?php //get_footer(); ?>

Open in new window


All I did was comment out get_header() and get_footer() and you should be able to do the same thing to get your desired result.
0
 

Author Comment

by:ezrhino5151
ID: 37830281
Thanks Jason, that did remove my footer but when I comment out the header I lose all formating.  Looks like the style sheet gets taken out along with it.
I'm using double column "Elegant Grunge" theme.  If that makes a difference.
0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 37830380
I thought you wanted just a plain/unformatted content to be embedded via iframe?  Anyway not a major problem.  Put the get_header() call back in and edit the theme's header.php file and remove elements manually.
0
 

Author Comment

by:ezrhino5151
ID: 37830455
Sorry if I wasnt clear.  I have been asking about this so much I think I am skipping details without knowing it.
I need to keep the WP install intact.  The blog will be accessable in both the iframe and in the subdomain, of where the install of the WP is.  So the blog will need all the elements.  Unless I can force the page to call on a seperate header that shares the same css style sheet.  And make the header a height of 1pixel.  Which I tried and was unsuccesful.
Thanks
Richard
0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 37830461
>> The blog will be accessable in both the iframe and in the subdomain

Ah-ha.  That makes things significantly harder.  So a given page or post has to look different if called from the iframe as opposed to being directly accessed from a subdomain?
0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 

Author Comment

by:ezrhino5151
ID: 37830490
Not a given page, only a specific page.  I was hoping that I could a create a specific page to place in the iframe that contained no header or footer, just body, side bars and posts.  
This will keep that particular page in the main site from having 2 headers.  When a user clicks on one of the posts in that page a new window would open to the WP domain with full header and footer.  I would add some java script with the iframe to force the the new window.
Thanks
Richard
0
 
LVL 70

Assisted Solution

by:Jason C. Levine
Jason C. Levine earned 400 total points
ID: 37830497
>> only a specific page

Okay, my original solution (custom page template, header and footer disabled) will still work then.  To avoid the formatting getting blown away, just add a calls to the CSS files in the customer page template.
0
 

Author Comment

by:ezrhino5151
ID: 37830528
Ok I'm all ears.  Where do I grab those calls? And I am guessing there is a specific place to put them in my page?
Thanks
Richard
0
 
LVL 4

Assisted Solution

by:dmgroom
dmgroom earned 100 total points
ID: 37831843
If you have commented out "get_header();", then you need to add in a certain amount of HTML in your page  where the get_header(); was:

<html>
<head>
<link rel="stylesheet" href="http://link-to-my-stylesheet.css" type="text/css">
<head>
....followed by enough opening <div>'s  that were in the original header file, that are needed to  match </div>'s in the footer
0
 

Author Comment

by:ezrhino5151
ID: 37839151
With commenting out the header and footer worked.  Then adding the css to the page worked as well to get me this far.  I am only having one last issue this worked for all browsers except ie.  Is there any thing I can do about it?
Here is the code for the pages I am working on.
  Update:
Although I was trying the page directly from my browser and the page wasnt lining up.  When I try it in the iframe, it lines up perfectly.
Thanks for all the good info and patients.
Thanks
Richard
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
The purpose of this video is to demonstrate how to Import and export files in WordPress. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php : Click on Too…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now