• Hey just re-adding my individual pages (contact, about etc)

    At the moment it is using the default style, however I want there to be individual css for pages. To distinguish the difference between a single post and the home(with all posts). Below is the code I am using, would it be possible to add an extra if statement, I’ve tried playing around with it but no luck.

    <?php echo is_single()? "<body class='single'>" : "<body>"; ?>

    Below is an example of a page I want to use different css for obvious reasons.

    http://adamhuxtable.com/about/

    I’ve been playing around with this for a while and still no luck

Viewing 6 replies - 1 through 6 (of 6 total)
  • <?php echo is_single()? "<body class='single'>" : "<body>"; ?>

    is just a compact version of:

    <?php if(is_single()) echo "<body class='single'>";
    else echo "<body>"; ?>

    from there you could try to expand the code; instead of using the original line, for instance, you could use:

    <?php if(is_single()) { echo "<body class='single'>"; }
    elseif(is_page('about')) { echo "<body class='about'>"; }
    else { echo "<body>"; } ?>
    Thread Starter Adam Huxtable

    (@ahux)

    Hey that works perfectly, however its still asking for an image:

    http://adamhuxtable.com/about/

    As you can see in the top left hand corner you can see the alt tag where the image is ment to be. I have tried doing the

    .pages div.post-item img {
    padding:0px;
    margin:0px;
    display:none;
    }

    But the issue is it hides all images. I’m stumpted to for ideas of how I can fix this. 🙁

    What I done to distinguish the difference between a single post and all posts is get it to pull up a different php file where I just simply removed the parts I didn’t want ie thumbnail image. I cant seem to do this for this part, any ideas?

    can you describe a bit more what you are trying to achieve?

    do you want an image instead of the page title?
    or no image at all in that position?

    if no image, then you might need to edit the code of the template file showing the pages.

    something like:
    <?php if(!is_page()) { /*show the image*/ }; ?>

    Thread Starter Adam Huxtable

    (@ahux)

    I’ve heard the phrase template page quite often, but in the theme I have created it doesn’t have one.

    Well at the moment index.php is my page where it displays all the posts —that works fine

    Individual Post are using a different page instead of index.php its using single.php — works fine

    But pages like About and Contact are I believe using index.php, what I want to do is remove the picture from these pages that is in the top right.
    Is there a way of either
    a) use single.php like individual posts
    b) I create a new page and link it to that, there I can add/remove areas of php to modify it to how I want it to look.

    I have split my site into separate php file:
    index.php
    single.php
    header.php
    footer.php
    sidebar.php
    functions.php
    comments.php

    Thank you for your time and patience, I’m pretty new to WordPress so still tryna get my head around it.

    Adam

    a way to do this is to copy the code of index.php and save it as page.php; then do the edits in page.php.

    see Template Hierarchy http://codex.wordpress.org/Template_Hierarchy

    Thread Starter Adam Huxtable

    (@ahux)

    Thank you so much, that’s exactly what I was looking for, I actually created a page and tried exactly that, apart from I named the file pages.php, hehe. Once again thank you!

    Adam

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Trying to do 3 "is" statements’ is closed to new replies.