Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

The index page of any wordpress blog has a same size of font in their heading. Can't we tailor size of headings by ourselves for each post?

If we change it by CSS, every heading will be changed. Or may be we can create a shortcode for it? Any clues to get started?

share|improve this question
    
Um… the index page and the fonts are managed by your theme –  bungeshea Jan 31 '13 at 20:53
add comment

2 Answers 2

If you theme is using body_class as it should be you can target just about any page you want with your CSS. For example, to target all h1 tags on author pages.

.author h1 {
  color:red;
}

Or all h2 on an archive page of any kind:

.archive h2 {
  color:red;
}

See the list on the Codex page or just view source on the page in question and look for <body then read off the classes.

share|improve this answer
add comment

If you are looking to have a unique heading (i.e. H1 style) on only your home page, you can do this two ways.

The preferred method is to create a custom style for just the H1 on your home page. Most themes generate body classes, such as 'home', 'page', 'blog', etc. Using the body class of your 'home' page you would add the following to your style.css file in the theme directory:

body.home H1 {
    (your custom style here)
}

Another method is to modify your template file with a custom query and insert your own code for just the page/content you specify. If you are changing the H1 of just blog posts on your homepage, you would modify Twenty Twelve's content.php file with something like this:

<?php if (is_home()): ?>
    (your H1 line goes here)
<?php endif; ?> 

You'll see similar code in the header section in content.php which will show you how the template handles whether the page is single post or not. You can tweak this pretty much any way you want. A list of body classes can be found here http://codex.wordpress.org/Function_Reference/body_class

It is ideal to keep your presentation changes (style) separate form your structure (layout). Using CSS approach instead of changing your template is recommended if you only want to change the style of the H1. If you want a custom layout you might want to explore creating a custom template from scratch. More on this approach can be found here http://codex.wordpress.org/Pages#Creating_Your_Own_Page_Templates

I hope this helps!

share|improve this answer
    
These again brings the similarity in all headings. May be we can check for certain category and then put headings of those post which lie in that category into a div. How is that possible? –  Komal Chauhan Feb 1 '13 at 20:38
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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