Forums

[resolved] How do I style headings on each post differently (5 posts)

  1. webmaster in texas
    Member
    Posted 1 year ago #

    I am trying to use different fonts and styles for each post title. How can I do this?

  2. alchymyth
    The Sweeper
    Posted 1 year ago #

    post_class()
    http://codex.wordpress.org/Function_Reference/post_class

    or basic principle to give a post dependant css class to the post title;for example:

    <h3 class="post-title post-title-<?php the_ID(); ?>"><?php the_title?(); ?></h3>

  3. beingzoe
    Member
    Posted 1 year ago #

    Specifically using alchymyth's example the css required to style an individual post title (style.css in your theme):

    /* Different header for pages and posts if post_class() is being used */
    .post h1, .post h2, .post h3 { /* whatever your actual h# tag(s) are */
       font-family: Helvetica;
       color: #111;
    }
    .page h1, .page h2, .page h3 {
       font-family: Georgia;
       color: #111
    }
    
    /* Individual post title by id like in alchymyth's example */
    .post-title-23 {
        font-family: Tahoma;
        color: #222;
    }

    If the post_class is being used then the containing element for each post/page in a loop or on a single/page template will output a variety of useful css selectors you use to customize invidual elements more than you need.

    Hope that helps.

  4. webmaster in texas
    Member
    Posted 1 year ago #

    Thank you so very much. I do believe this is what I was looking for.

  5. zoonini
    help me help you
    Posted 1 year ago #

    If you would please mark this thread as "resolved" it would be appreciated. Helps everyone keep better track of whose issues are still outstanding. Thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic