Forums

Page Design (15 posts)

  1. macart
    Member
    Posted 2 years ago #

    Hi Guys, still learning,

    My site has three pages, "About", "Gallery", and "Blog".

    The changes I made to my .post in my stylesheet have appeared on all the pages, but I wanted this style only on my "Blog" page. So what is the best way to style each page? My search has turned up using categories like this:

    <?php if (is_category('tomato')){echo 'class="tomato-red"';}
    if (is_category('cucumber')){echo 'class="cucumber-green"';} ?>

    Another site said to create different index.php files, confused as to best solution.

    My site is using a static front page with the Blog page acting as my posts' page.

    Thanks

  2. Natko
    Member
    Posted 2 years ago #

    If "blog" is a page just make blog.php in theme folder and style it as you wish. Copy everything you need from page.php (like get_header(); and get_footer(); for example) and change the rest.

    About and Gallery will have the same style (from page.php), and Blog will have it's separate style (from blog.php).

  3. macart
    Member
    Posted 2 years ago #

    How is this done when any change to .post in the css is applied to every page?

  4. macart
    Member
    Posted 2 years ago #

    How do you design the pages differently? Since .post in the css effects every page? Am I missing something?

  5. ClaytonJames
    Member
    Posted 2 years ago #

    I think what designers chair is suggesting... "just make blog.php in theme folder and style it as you wish".

    ..is that you take your newly created page template and give it a different style by changing the class in your new page template from "post", to something else. Then define your new class by adding it to your style sheet.

  6. macart
    Member
    Posted 2 years ago #

    My site is using a static front page with the Blog page acting as my posts' page. I've setup a page.php and have my index.php. Index.php is for my blog and page.php is for the other static pages.

    If I take out the info below out of my page.php then it doesn't pull in the page I have setup.

    <?php if(have_posts()) : ?><?php while(have_posts()) : the_post(); ?>
            <div class="post">
            <h2><?php the_title(); ?></h2>
            <div class="entry">
            <?php the_content(); ?>
            </div>
            <!--End Entry-->
            <span class="editthis"><?php edit_comment_link('FIX THIS'); ?></span>
            </div>
            <!--End Post-->
            <?php endwhile; ?>
            <?php else: ?>
            <h2> Not Found</h2>
            <p> Sorry what your looking for isn't here, please try again!</p>
            <?php endif; ?>

    How do I pull in my pages, about, etc. What do I change in the code above? So that I can style my .posts separately from my pages?

  7. macart
    Member
    Posted 2 years ago #

    How do you design pages separately from posts, when .post in the css seems to be on every page created in wordpress?

  8. Rev. Voodoo
    Volunteer Moderator
    Posted 2 years ago #

    what they are suggesting...is you need to make a page template
    http://codex.wordpress.org/Pages#Page_Templates

    so, you can make a page template (if you want it to function the same as your current page.php just copy the code from page.php to the new template)

    In this new template, change <div class="post"> or whatever needs changed to some new tag....something as simple as post2 (you can now add these new tags to style.css and apply your desired styling)

    Assign this new template to the page you want to be styled differently from the drop down menu within the edit page interface

  9. macart
    Member
    Posted 2 years ago #

    This is how wordpress controls the page and post designs in css? WordPress seems smarter than this, seems like this would already be built in solution that I'm missing.

  10. Rev. Voodoo
    Volunteer Moderator
    Posted 2 years ago #

    this IS a built in solution

    wordpress usually uses index.php to control your blog post page

    it uses page.php to control your individual pages as a whole

    it also uses other standard templates to control display of certain things based on template heirarchy
    http://codex.wordpress.org/Templates_Hierarchy

    when you want a custom look to certain pages, that's when you make a page template

  11. s_ha_dum (was apljdi)
    Member
    Posted 2 years ago #

    @macart,

    All of the suggestions you've been given seem reasonable and acceptable. I'll offer another option though. Since version 2.8 WordPress has had a function called body_class which inserts all kinds of location specific classes into the <body> tag of each page. Using those classes you can easily target your CSS to most pages. To get this working your theme needs to call the body_class() function. The link provided explains how to do that. The benifit is that by using the body_class() function you should only have to create templates when you make changes to page structure-- adding or subtracting divisions, adding sidebars, etc..

  12. macart
    Member
    Posted 2 years ago #

    Coolio! Thanks for the help everyone!

  13. macart
    Member
    Posted 2 years ago #

    Ok Ive set up my page with a blog.php, index.php and a page.php file.

    My home page is displaying my blog posts, instead the info on the "home" page I have created in pages. How do I change this?

    Thanks

  14. macart
    Member
    Posted 2 years ago #

    Can this be done without going into my settings and changing the Front page displays in dashboard? Can I display my page "home" in my pages without going into settings?

    I have followed option 2 here:
    http://www.nathanrice.net/blog/creating-a-blog-page-with-paging/

    Thanks

  15. henkholland
    Member
    Posted 2 years ago #

    Go to Dashboard/Settings/Reading and select "Front page displays" a static page and then select your frontpage and your posts page.

Topic Closed

This topic has been closed to new replies.

About this Topic