Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS wordpress: creating pages

  • This topic is empty.
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #37819
    shamai
    Member

    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.

    #101901
    TheDoc
    Member

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

    #101902
    shamai
    Member

    and style it using the style.css file?

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

    #101903
    TheDoc
    Member

    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.

    #101905
    clicknathan
    Member

    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. :)

    #101911
    shamai
    Member

    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!

    #101914
    TheDoc
    Member

    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)
  • The forum ‘CSS’ is closed to new topics and replies.