Tell me more ×
WordPress Answers is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I created a page template following the instructions here in Codex.

So now, in the "twentyeleven-child" folder, I have the following files:

  • content.php
  • functions.php
  • page.php
  • (!) salespagetemplate.php
  • single.php
  • style.css

salespagetemplate.php is the new page template I created, and I need to set margins, font sizes for headings and body copy, and other things for this page template.

In what file(s) do I set margins, fonts, and font sizes for headings and body copy?

I was thinking style.css, but it can't be that, because if I made changes to that I think it would make changes to the appearance of other pages that don't have the new page template applied.

So do I set these things in the file 'salespagetemplate.php'?

EDIT: In response to "what's being printed in the html body tag":

If I understand the question correctly, it's about what content I have posted on a Page which has the Page Layout applied...?

The content can be seen here: http://richardclunan.com/this-is-a-test-page/

share|improve this question

closed as off topic by kaiser, Wyck, toscho Oct 3 '12 at 0:54

Questions on WordPress Answers are expected to relate to WordPress within the scope defined in the FAQ. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about closed questions here.

2 Answers

changes in appearance are made via the (child) theme's style.css file. If you want to target specific pages or types of content, use the body_class:

#content {
    margin: 1em;
}

body.single-my-post-type #content {
    margin: 0.5em;
}
share|improve this answer
more specific, for that particular page template: .page-template-salespagetemplate-php – Michael Jul 31 '12 at 16:16
so is this the code?: page-template-salespagetemplate-php #content { margin: 0.5em; } – Richard Jul 31 '12 at 16:56
I'm not sure if I added it in the right place. Changes didn't occur on a page with the template applied. Here's the code I have in style.css now: } #content { margin: 0 34% 0 7.6%; width: 58.4%; } page-template-salespagetemplate-php #content { margin: 0 34% 0 7.6%; width: 58.4%; – Richard Jul 31 '12 at 16:58
@Richard What is being printed in your Html's <body> tag? . . . . . . . . Please, add this information about the body tag to the Question itself. – brasofilo Jul 31 '12 at 19:06
First, if you want the page to look different from the regular pages you should not be using the same styling for #content and .page-template-salespagetemplate-php #content. Second, you forgot the . in .page-template-salespagetemplate-php. Finally, your <body> element in the example page has no classes, so the styling would not work anyway. Why the body_class function referred to by Milo is not doing it's job is unclear to me. You're not overriding header.php and it's working fine on your home page. – W van Dam Jul 31 '12 at 22:05

looking at the source of your posted page, it seems that you haven't quite build you page accordingly.

in your page template include elements like <?php get_header(); ?> and get_footer() or write yourself the proper html in your header.php, make sure your body tag is written as <body <?php body_class($class); ?>>

then as others pointed out, use css selectors in the child theme style.css to target headings and body elements.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.