ThecounT
Member
Posted 1 year ago #
Hey! Trying to have a different width for my content on my index and single.php.
I want to use 2 sidebars on my index and only 1 on the single.php and widen content for that page.
I have sidebar thing worked out just need detailed help on how to have two directives for the content styling, single and index.
Thanks!
Assuming your main content area currently uses something like <div id="content">, try changing it to:
<?php $content_width = 'narrow';
if( is_single() ) $content_width = 'wide';?>
<div id="content" class="<?php echo $$content_width;?>">
That should produce <div id="content" class="narrow"> on every page except single post pages - which should have <div id="content" class="wide">.
Next, edit your stylesheet and remove any reference to width on #content. Instead, add the width setting to a .narrow class and add the single post's content width to a .wide class.