Grow your CSS skills. Land your dream job.

wordpress: creating pages

  • # April 27, 2012 at 3:00 pm

    im almost done with my first wordpress site.
    im using a page as my front page.

    so how exactly do you style pages?
    i made a special template page-home.php for the home page and i have the basic loop in there to show the page which is created inside the page editor in the wp admin.

    is that how it is suppose to be done?
    or do people not even include the loop which means the page is really totally disconnected from wordpress.

    now to style it, I can put inline styling into the page editor in wordpress, what do others do?
    In the page template I can change the html only so much to output the post (or I should say page) differently then regular posts.

    how do others make static pages?

    edit: i just discovered art direction plugin. looks like an answer but feel free to give your own. also if i use styling in the header i dont think that css will be cached so if I use a cache plugin, I will still not have a front page thats cached.

    # April 27, 2012 at 3:15 pm

    I like using proper WordPress templates. In this case, I’d use front-page.php and set my home page in my WordPress Settings.

    # April 27, 2012 at 3:58 pm

    and style it using the style.css file?

    but what if you have different pages that have totally different looks?

    # April 27, 2012 at 4:11 pm

    You can use the body_class() function to add different classes to the body tag. That will enable you to specifically target your page type in your css file.

    # April 27, 2012 at 4:34 pm

    Firstly, I personally wouldn’t worry about using a caching plugin until you’re more comfie with working with your theme. The nature of caching means you won’t see CSS / template changes very easily.

    Next, like TheDoc said, check your header.php file for the < body> tag, and make sure it reads

    >

    That way, you’ll have a class that’s different for different types of content ( ie, the home page gets a .home class, the main blog index gets a .blog class, other Pages get .page, single posts get .single, and so on).

    Then you can style specific items or entire pages based around CSS in your style.css file like:

    body.home p {color:red;}
    body.blog p {color: blue;}

    That’s how you do what you’re asking, generally. The next step is learning CSS well enough to answer questions like this. :)

    # April 27, 2012 at 5:47 pm

    got it.

    I have been using post_class() to do this and i think I will stick with it because nothing else changes except whats inside the post or page.
    everthing in header and other stuff is the same.

    ok thanks!

    # April 27, 2012 at 6:08 pm

    You should be using body_class on every WordPress project – it’s a staple for me for sure.

    If you’re doing things right, it should be extremely useful.

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".