Title: diff style on latest post, diff layout for single
Last modified: August 18, 2016

---

# diff style on latest post, diff layout for single

 *  [retardedjimmy](https://wordpress.org/support/users/retardedjimmy/)
 * (@retardedjimmy)
 * [21 years, 9 months ago](https://wordpress.org/support/topic/diff-style-on-latest-post-diff-layout-for-single/)
 * Hi all,
    I’m new to wordpress, but working my way steadily through a redesign
   from moveable type. I love all the functionality, and I’m quickly picking up 
   the php ins and outs as I go along. I have the feeling these two questions are
   easy to answer, but I haven’t yet seen documentation, on wiki or boards. 1) On
   my main homepage, I want to emphasize the latest post, probably by using different
   style tags in my wp-layout css. Can I single out the first post (latest post 
   shown) and style it differently than the others shown on the page? 2) I want 
   to put different lists on the side menu on single post pages (individual archives
   in mt speak), but it seems like single post pages are just the index.php layout
   with only one post inside “#content”. Can I change my side menu based on how 
   many posts are being shown in the main content area? Can anybody point me in 
   the right direction on either one of these? Thanks much

Viewing 15 replies - 1 through 15 (of 16 total)

1 [2](https://wordpress.org/support/topic/diff-style-on-latest-post-diff-layout-for-single/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/diff-style-on-latest-post-diff-layout-for-single/page/2/?output_format=md)

 *  [moshu](https://wordpress.org/support/users/moshu/)
 * (@moshu)
 * [21 years, 9 months ago](https://wordpress.org/support/topic/diff-style-on-latest-post-diff-layout-for-single/#post-92561)
 * for question #2:
    Take a look at this [http://wiki.wordpress.org/HideStuffOnPermalinkPage](http://wiki.wordpress.org/HideStuffOnPermalinkPage)
 *  Thread Starter [retardedjimmy](https://wordpress.org/support/users/retardedjimmy/)
 * (@retardedjimmy)
 * [21 years, 9 months ago](https://wordpress.org/support/topic/diff-style-on-latest-post-diff-layout-for-single/#post-92578)
 * Nice. Here’s what the solution looks like. In index.php:
    `<div id="menu"> <?
   php if ($single) { ?> blah blah blah menu for single page blah blah blah <?php}?
   > <?php if (!$single) { ?> blah blah blah menu for front page/archives <?php }?
   > </div> Thanks. Any ideas on #1 anyone?
 *  Thread Starter [retardedjimmy](https://wordpress.org/support/users/retardedjimmy/)
 * (@retardedjimmy)
 * [21 years, 9 months ago](https://wordpress.org/support/topic/diff-style-on-latest-post-diff-layout-for-single/#post-92585)
 * Ok thanks Beel (and moshu, i didn’t thank you before).
    That works, kind of. 
   Once I got it, it worked out (the `else` has to be closed before the `endforeach`
   of the loop, in case anyone else is trying it), but the problem now is that it
   changes the format of _every_ first post, not just the ones on the homepage, 
   but also the ones on the archives, even on the individual pages. I could probably
   work around it, but the front page is meant to be like a splash, with a bigger,
   brighter design then the rest. Does anyone know if there are any global flags
   to test whether a page is an archive (monthly or cat), a single page or the basic
   homepage? `$single` works, but is there a `$home` or an `$archive`? Heh, thinking
   out loud, that means I’d have to put my `$count` loop inside yet another `$home`
   test loop. 🙂 good times.
 *  [Beel](https://wordpress.org/support/users/beel/)
 * (@beel)
 * [21 years, 9 months ago](https://wordpress.org/support/topic/diff-style-on-latest-post-diff-layout-for-single/#post-92642)
 * What version of WP are you using?
 *  Thread Starter [retardedjimmy](https://wordpress.org/support/users/retardedjimmy/)
 * (@retardedjimmy)
 * [21 years, 9 months ago](https://wordpress.org/support/topic/diff-style-on-latest-post-diff-layout-for-single/#post-92646)
 * 1.2 mingus
 *  Thread Starter [retardedjimmy](https://wordpress.org/support/users/retardedjimmy/)
 * (@retardedjimmy)
 * [21 years, 9 months ago](https://wordpress.org/support/topic/diff-style-on-latest-post-diff-layout-for-single/#post-92688)
 * Found a solution, if not a very smooth or beautiful one…
    Basically I used `if(!
   single)`, `if ($p)`, `if ($m)’, and ‘if ($cat)’ a lot. There are crazy loops 
   all over the page, and unfortunately everything gets loaded everytime index.php
   is loaded (a blog all in one page!), but I can do what I wanted, which is show
   different menus and different formatting depending on what page I’m on. Maybe
   1.3 will have a better method of linking to new templates. In the meantime, if
   anyone knows a better way, I’m all ears.
 *  [charle97](https://wordpress.org/support/users/charle97/)
 * (@charle97)
 * [21 years, 9 months ago](https://wordpress.org/support/topic/diff-style-on-latest-post-diff-layout-for-single/#post-92689)
 * if you’re using the clean uri option for your permalinks, you can create separate
   templates for individual and category archives and then modify the rewrite rule
   corresponding to each type of archive by replacing ‘index.php’ with the names
   of the templates.
 *  [Doraemon](https://wordpress.org/support/users/doraemon/)
 * (@doraemon)
 * [21 years, 8 months ago](https://wordpress.org/support/topic/diff-style-on-latest-post-diff-layout-for-single/#post-92863)
 * Charle, could you further explain the process that would be needed to achieve
   these separate templates? If you could walk me through what I’d have to do to
   set this up that would be great. Thank you!
    Max
 *  [elasticdog](https://wordpress.org/support/users/elasticdog/)
 * (@elasticdog)
 * [21 years, 8 months ago](https://wordpress.org/support/topic/diff-style-on-latest-post-diff-layout-for-single/#post-92864)
 * Boy…that formatting didn’t really work. Let me try again:
    ` // Faking multiple
   templates for #subcolumn if ($single) { require('includes/subcolumn-single.php');//
   individual posts } else if ($cat) { require('includes/subcolumn-category.php');//
   categorical listings } else if ($m) { require('includes/subcolumn-month.php');//
   monthly listings } else if ($year) { require('includes/subcolumn-year.php'); //
   yearly listings } else { require('includes/subcolumn-home.php'); // home page}
 *  [Doraemon](https://wordpress.org/support/users/doraemon/)
 * (@doraemon)
 * [21 years, 8 months ago](https://wordpress.org/support/topic/diff-style-on-latest-post-diff-layout-for-single/#post-92865)
 * Thanks ElasticDog. Not exactly what I was looking for.. I should give an example.
   Let’s say I have my index.php and I format it and it’s all perfect for the index
   of my site, then I have another category which is “news” and I want to use different
   HTML for that page; I want to take this category and link it’s template to a 
   different file. Maybe it’s the same template with some introductory text at the
   beginning which is only relevant to the news section of the site and therefore
   should only be displayed there. I’m new to WP and not so great with PHP, so if
   you guys have some ideas you might have to walk me through the process. Thanks
   again!
    Max
 *  [Doraemon](https://wordpress.org/support/users/doraemon/)
 * (@doraemon)
 * [21 years, 8 months ago](https://wordpress.org/support/topic/diff-style-on-latest-post-diff-layout-for-single/#post-92873)
 * Thanks a lot! I really appreciate your help, absolutely invaluable!
 *  [Doraemon](https://wordpress.org/support/users/doraemon/)
 * (@doraemon)
 * [21 years, 8 months ago](https://wordpress.org/support/topic/diff-style-on-latest-post-diff-layout-for-single/#post-92874)
 * Can I substitute the category id in place of the name? Such as:
    `<?php if ("
   2" != $cat) { include(ABSPATH . 'wp-comments.php');  } ?>
 *  [elasticdog](https://wordpress.org/support/users/elasticdog/)
 * (@elasticdog)
 * [21 years, 8 months ago](https://wordpress.org/support/topic/diff-style-on-latest-post-diff-layout-for-single/#post-92875)
 * That’s a good question…I honestly don’t know. If you _can_ do it, you’d have 
   to leave the category ID outside of quotes, since it’s a value and not a string.
   So that would give you:
    `<?php if (2 != $cat) { include(ABSPATH . 'wp-comments.
   php'); } ?> …but I don’t know if that will work or not. Give it a shot 🙂
 *  [Doraemon](https://wordpress.org/support/users/doraemon/)
 * (@doraemon)
 * [21 years, 8 months ago](https://wordpress.org/support/topic/diff-style-on-latest-post-diff-layout-for-single/#post-92876)
 * Interestingly enough here’s what I did:
    `<?php if ("11" == $cat) { } // If we're
   at the about us page, don't show comments else if ("18" == $cat) { } // If we're
   at the beta page, don't show comments else { include('comments.php'); include(
   ABSPATH . 'wp-comments.php'); } ?> I had to put my feedback div in an external
   file and include it in this script so that it would disappear. Note, this is 
   about the extent of my PHP knowledge, but it does work. Again, thanks for your
   help, Max
 *  [Doraemon](https://wordpress.org/support/users/doraemon/)
 * (@doraemon)
 * [21 years, 8 months ago](https://wordpress.org/support/topic/diff-style-on-latest-post-diff-layout-for-single/#post-92877)
 * Interestingly enough here’s what I did:
    `<?php if ("11" == $cat) { } // If we're
   at the about us page, don't show comments else if ("18" == $cat) { } // If we're
   at the beta page, don't show comments else { include('comments.php'); include(
   ABSPATH . 'wp-comments.php'); } ?> I had to put my feedback div in an external
   file and include it in this script so that it would disappear. Note, this is 
   about the extent of my PHP knowledge, but it does work. Again, thanks for your
   help, Max

Viewing 15 replies - 1 through 15 (of 16 total)

1 [2](https://wordpress.org/support/topic/diff-style-on-latest-post-diff-layout-for-single/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/diff-style-on-latest-post-diff-layout-for-single/page/2/?output_format=md)

The topic ‘diff style on latest post, diff layout for single’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 16 replies
 * 6 participants
 * Last reply from: [elasticdog](https://wordpress.org/support/users/elasticdog/)
 * Last activity: [21 years, 8 months ago](https://wordpress.org/support/topic/diff-style-on-latest-post-diff-layout-for-single/page/2/#post-92904)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
