I would like to have a second layout for this page to basically show a slightly altered / more concise version (using the same post info) which could be accessed at something like mysite.com/customtype/mypost/alt or mysite.com/customtype/mypost?alt or similar.
What might be the best way of going about this?
]]>Add a query string to your links, so something like mysite.com/customtype/mypost?myview=concise
Then at the top of your single-customtype.php, have $myview = $_GET['myview'];
Add this to your body classes in header.php (how you do this depends on your theme, but for me it’d be <body <?php body_class( $myview ); ?>>
).
Finally you can easily control what is and isn’t seen using CSS, eg body.concise .myclass { display: none; }
Hope that helps
]]>But if I wanted to have a completely different layout all together how would I go about doing that?
]]>For example, a box can be floated right for normal view, or floated left for another, eg:
.myclass { float: right; }
body.concise .myclass { float: left; }
Doing it that way would keep your development to a minimum as you’d only need one set of code.
But, if you wanted to, the query string can still be used, eg:
$myview = $_GET['myview'];
if ( $myview != "concise" ) {
// code to display normal view
} else {
// code to display concise view
}
Oh, BTW, when I said originally “at the top of your single-customtype.php” I meant “at the top of header.php“!
Peter
]]>