Domain Manage

Removing sidebars from specific pages?

Discussion in 'Wordpress' started by viceroy, Jul 27, 2011.

Thread Status:
Not open for further replies.
  1. viceroy United Kingdom

    viceroy Active Member

    Joined:
    Sep 2010
    Posts:
    296
    Likes Received:
    2
    Hey, was just wondering if anyone knows how to remove sidebars from a specific page (but leaves them on the rest of the site).
    Example: have been playing with a bit of wordpress recently and have set up clubcard/info to learn. Now I've sorted the sidebars on the pages but don't want them to show up on the page that the search results show up on in order to comply with the custom search engine 795 px minimum. Basically need to remove sidebars to be able to use the whole page.
    Any help/ info would be much appreciated!
     
  2. Domain Forum

    Acorn Domains Elite Member

    Joined:
    1999
    Messages:
    Many
    Likes Received:
    Lots
     
  3. fish United Kingdom

    fish Well-Known Member

    Joined:
    Nov 2006
    Posts:
    2,725
    Likes Received:
    27
    Depending on the theme you can disable sidebars in the page attributes tab check out the template dropdown to view your options.
     
  4. viceroy United Kingdom

    viceroy Active Member

    Joined:
    Sep 2010
    Posts:
    296
    Likes Received:
    2
    Hey fish, thanks for the reply, unfortunately theme doesn't have that option and I've tried editing the page.php file but can't get the results I'm after... it's driving me insane!:)
     
  5. AssetDomains United Kingdom

    AssetDomains Well-Known Member

    Joined:
    Feb 2010
    Posts:
    2,951
    Likes Received:
    52
    You can set up specific template to show you results if you theme doesn't have one already

    http://codex.wordpress.org/Creating_a_Search_Page

    If you already have a search page just simply remove the sidebar call from it.

    If this makes no sense and you use a freely available theme post its name and I'll take a look
     
  6. viceroy United Kingdom

    viceroy Active Member

    Joined:
    Sep 2010
    Posts:
    296
    Likes Received:
    2
    hey newpbc,

    thanks for the help, theme is a custom one, made when i was a little less experienced... basically, i'm just trying to show the search results on a static page (www.clubcard.info/search-results) and want to remove sidebars and use the entire page area to display results from the custom search engine, i'm not sure about setting up a template to display the search results and don't have the option to choose a template when writing a page anyway?
    I've sort of gathered that i'm going to have to figure out some php to remove sidebars from just a single page and then list the ones i want them shown on?
    might just remake the entire theme at this rate...
    any thoughts?
    cheers!
     
  7. AssetDomains United Kingdom

    AssetDomains Well-Known Member

    Joined:
    Feb 2010
    Posts:
    2,951
    Likes Received:
    52
    Does your theme have a file called search.php

    If not try this make a copy of your index.php rename it search.php

    Open search.php Then remove reference to sidebar 1 and sidebar 2
     
  8. peter_w United Kingdom

    peter_w Active Member

    Joined:
    Nov 2008
    Posts:
    558
    Likes Received:
    18
    This page should hold the answer.

    http://codex.wordpress.org/Conditional_Tags

    Just wrap the whole sidebar with one of the conditionals, by the sounds of it:

    <?php if(is_page('search-results')) { ?>

    Sidebar code

    <?php } ?>
     
  9. peter_w United Kingdom

    peter_w Active Member

    Joined:
    Nov 2008
    Posts:
    558
    Likes Received:
    18
    That should have been !is_page but I can't seem to edit the post on my iPhone.
     
  10. viceroy United Kingdom

    viceroy Active Member

    Joined:
    Sep 2010
    Posts:
    296
    Likes Received:
    2
    Peter,

    Thanks for the reply, i did try this earlier but can't get the text/ content to take over the whole of the page, i'll prob have to play with the css? Have left this mod live if you want to se what i mean:) thanks again for the help!!

    cheers!
     
  11. viceroy United Kingdom

    viceroy Active Member

    Joined:
    Sep 2010
    Posts:
    296
    Likes Received:
    2
    thanks guys for the help, have gone and made another theme, needed an update anyways, too many tweaks here and there made life way too complicated! got to look into conditionals more, some great applications:)
    thanks again,
    cheers
     
  12. Skinner

    Skinner Well-Known Member

    Joined:
    Jul 2008
    Posts:
    4,325
    Likes Received:
    81
    Welcome to programmer world, we'd rather walk a 500 miles over broken glass to 'make something work', rather than a leisurely 500 mile country drive to start from scratch ;)
     
  13. nick-harper United Kingdom

    nick-harper Active Member

    Joined:
    Jun 2011
    Posts:
    391
    Likes Received:
    8
    I am much the opposite, I find it so much easier and quicker to make from scratch rather than trying to figure out how to make wp do it :(
     
  14. Skinner

    Skinner Well-Known Member

    Joined:
    Jul 2008
    Posts:
    4,325
    Likes Received:
    81
    Wordpress gives me a constant headache.

    When it comes to mini-sites I like to build them in php.

    Doesn't stop me wasting half my day adapting includes and classes when I should really just start from scratch. Once you've put time in, it seems a waste to bin it, so you keep on slugging ;)

     
  15. seemly

    seemly Active Member

    Joined:
    Feb 2011
    Posts:
    973
    Likes Received:
    39
    couldn't you have just changes the CSS to suit the given page?

    Wordpress assigns each page with it's own class assigned to the <body> tag, giving you the ability to do this in the CSS:

    Code:
    body.search .sidebar {display:none;}
     
  16. peter_w United Kingdom

    peter_w Active Member

    Joined:
    Nov 2008
    Posts:
    558
    Likes Received:
    18
    This is theme specific, though. Not all themes, especially custom ones, will do this.

    A solution would have been to add an extra line of CSS inside the <head> on the specific page.

    <?php if(is_page('search-results) { ?>
    #maincontent { width:1000px; }
    <?php } ?>
     
  17. golddiggerguy United Kingdom

    golddiggerguy Well-Known Member

    Joined:
    Apr 2007
    Posts:
    3,637
    Likes Received:
    25
    Install this theme and view the bottom of a page whilst editing it - It has options for lots of options you can dig into the code for and see how it's done.

    Blend 1.5 http://spectacu.la/blend/
     
  18. viceroy United Kingdom

    viceroy Active Member

    Joined:
    Sep 2010
    Posts:
    296
    Likes Received:
    2
    Hey everyone,

    Thanks for the continued help!
    @ skinner: yep, programming is not my thing so once i'd put it all together and got it working i figured it'd be a waste to chuck it and start again:)
    @ seemly: suppose i could have tried but like i said, the constant tweaking without a changelog started to make everything 'fuzzy':)
    @ golddiggerguy: cheers for the link, will look into it.
    I feel i'm being dragged deeper into php although this wasn't my intention!
    thanks again guys!
     
  19. viceroy United Kingdom

    viceroy Active Member

    Joined:
    Sep 2010
    Posts:
    296
    Likes Received:
    2
    Update:)
    Have sorted the theme to work properly with updated wp install! Search results covering the whole page!:lol:
     
Thread Status:
Not open for further replies.

Share This Page