How to remove sidebar on 1 page, and keep it on the others?
-
I’ve been trying to figure it out a bit, but instead of spending more time doing that, I could just ask here.
https://www.alxdesigns.com/dev/wp/home
I’d like to have the sidebar on all pages, except on the Gallery page. How do I deactivate it?
Thanks / Alx
-
Ok I got the example done above but when I go to create a new page and use the dropdown box to change the theme it only gives me one choice the default theme, any suggestions?
this is what i used as a solution for my problem
<?php
if(is_page(‘welcome’)) {
print ‘<div class=”contentL”>’;
include(“contentL.php”);
print ‘</div>’;
print ‘<div class=”contentM”>’;
include(“contentM.php”);
print ‘</div>’;
print ‘<div class=”contentR”>’;
include(“contentR.php”);
print ‘</div>’;
}
?>Or, to make it a little easier to read you could do…
<?php if(is_page('welcome')) : ?> <div class="contentL"><?php include('contentL.php');?></div> <div class="contentM"><?php include('contentM.php');?></div> <div class="contentR"><?php include('contentR.php');?></div> <?php endif;?>
To post code in the forum here, please use backticks (top left, next to the 1 key)… as indicated in the post box (the one you type into).
Or use a pastebin.
https://wordpress.pastebin.ca/hey man thanks a lot I really appreciate your help.
hello again t31os im getting a strange problem with my divs it is adding a scroll bar to each div in firefox and in IE it doesn’t push the content of the blog down (it just sites on top of it) ill past my
header.php
<!-- header START --> <div id="header"> <div id="caption"><div id="navigation"> <ul id="menus"> <li class="<?php echo($home_menu); ?>"><a class="home" title="<?php _e('Home', 'inove'); ?>" href="<?php echo get_settings('home'); ?>/"><?php _e('Home', 'inove'); ?></a></li> <?php if($options['menu_type'] == 'categories') { wp_list_categories('depth=2&title_li=0&orderby=name&show_count=0'); } else { wp_list_pages('depth=2&title_li=0&sort_column=menu_order'); } ?> <li><a class="lastmenu" href="javascript:void(0);"></a></li> </ul> </div></div> <?php if(is_page('welcome')) : ?> <div class="contentL"><?php include('contentL.php');?> </div> <div class="contentM"><?php include('contentM.php');?> </div> <div class="contentR"><?php include('contentR.php');?> </div> <?php endif;?>
style.css
.contentL{ width:270px; height:238px; margin-top:20px; margin-left: 40px; float:left; overflow:auto; } .contentM{ width:270px; height:238px; margin-top:20px; margin-left: 20px; float:left; overflow:auto; } .contentR{ width:270px; height:238px; margin-top:20px; margin-right: 20px; margin-left: 20px; float:left; overflow:auto; }
ContentL.php,ContentM.php,ContentR.php
these pages just are completly blank with just some filler text no html or php
thanks in advanced!
They will do that, you have
overflow:auto
…Which in simple terms basically means, when the content in this element exceeds the width of the element then automatically add scrollbars.
That will naturally happen…
What would you like it to do?
basically word wrap inside the contentL,M,R div
do you have any ideas about the IE problem?
hey also, i see that you are very knowledgeable in PHP do have any pointers on good places to start to learn?
You’d be best off starting with HTML and CSS, for starters it’s easier, and secondly knowing PHP without the HTML and CSS is not going to be much use when using WordPress, at least not in my opinion.
Learn by doing, search when you get stuck… Start a project, whether it be a 4 page website or a basic CMS, write it yourself and learn as you go…
Google is your friend…
W3Schools is a good site for info.
https://www.w3schools.com/Xhtml/
https://www.w3schools.com/css/Sitepoint.com i find have some of the best online guides available.
Once you grasp HTML and CSS you’ll be able to understand the structure of a webpage, and be able to build pretty much any design you like… of course graphics are another subject. I still learn new things about HTML and CSS now and i’ve been at it on and off for years, and pretty sure it’s the same for any web language, as they’re constantly evolving.
When i started building webpages it was back when Geocities (free host) had a basic “Web Builder” (years ago now) .. a browser based page designing utility, you move boxes around the screen, enter text and it creates the HTML for you…etc etc… lol, shocking code of course…
Then moved onto building with tables in frontpage, which i stuck with for quite a while doing websites for clans i played in etc…. granted they weren’t mind blowing designs but it was enjoyable picking scripts apart and learning how to format a design to make it work, and learning how different elements effect each other…
HTML has come a long way since then though. It’s far easier to use, and now we have CSS to accompany it, which while great can be a little overwhleming if you’re just starting to write code.
Find a decent app for HTML and it’ll make learning alot easier..
This looks good since it’s free!….
https://www.w3.org/Amaya/Not used it, but looks pretty good..
Thanks a lot for the advice and the link references they will come in handy. i think i have a pretty good grasp on HTML and CSS its really just the PHP that is new to me. but basically going back three posts ago do you know a solution to my problem with my divs?
https://www.w3schools.com/CSS/pr_text_white-space.asp
Remove the overflow auto….
I am still having that problem its not the overflow or the white-space. I think it might have somthing to do with the .php file that it is calling with the text. if i make an error in the php of header.php the error message is contained within the div but the text that i have in the “contentL.php” still overflows across the page. any ideas!?
Browser Variation is not a php problem. It is a css problem. Try switching the use of margins to padding or paddings to margin…. because that is what often causes …
nah that didn’t change anything. i really don’t think in this case it has something to do with the CSS, anymore info would be appreciated.
I am about 95% confident that it is your CSS. Browser Variations are not caused due to php codes. It is nearly almost always caused by the CSS.
- The topic ‘How to remove sidebar on 1 page, and keep it on the others?’ is closed to new replies.