This is searchable archive of our old support forums, which operated from 2012 - 2016. To find out how to get support for your current theme, please visit our support page.

Disable widget area on specific pages

Viewing 9 replies - 1 through 9 (of 9 total)
  • Author
    Replies
  • #13288
    Jason Bobich
    Keymaster

    Hello,

    Yet the answer is surely relevant for me too. It would be great if purchasing any of your themes allowed you to view the entire support site. But if this is not possible, could you paste that answer here?

    This isn’t something I’m going to allow on the forums for a few reasons I don’t really want to discuss publicly, but I’d be glad to paste the answer here for that or anything else if you just ask like you’re doing now.

    ============

    Hi, is there a way to NOT show the “ad above content” on certain pages?

    So you’ve placed a widget into the default widget area location “Ads Above Content” but now you don’t want that widget displayed across your entire website. —

    There’s no direct feature for this. By design, the default widget area locations will show across the entire website, and allow you to swap in your custom widget areas into these locations for specific pages.

    http://dev.themeblvd.com/tutorial/widget-areas-for-the-end-user/

    However, since this is a collapsible widget area location we’re talking about, it’s default location can be left blank by not including any widget in it.

    So, the alternate approach to what you’re trying to do that would work is to create a custom widget area, and then assign it to the pages you want it displayed, leaving the default one blank.

    Now if it turns out this really doesn’t work for you, the only other thing I can think of is that you could just manually hide the widget area with Custom CSS on certain pages. WordPress gives us classes on the <body> tag that allow us to target specific pages. So, you could do something like this:

    .page-id-1 .main-top,
    .page-id-2 .main-top,
    .page-id-3 .main-top {
    	display: none;
    }

    ============

    For CSS changes, it’s a good idea to use a tool like firebug or Google Chrome’s built-in developer tools to locate them and then put the edits either in your child theme or in the “Custom CSS” option on your theme options page.

    Also, here’s a helpful tutorial on how to use Firebug – http://vimeo.com/20917974. The only thing I’d suggest not doing is actually making edits to the theme’s CSS files, as it shows at the end of that video. However, the video serves as a good introduction to Firebug and how it can be used to find what CSS is effecting certain areas of your site without ever digging around in any files.

    #13308
    Robert Piller
    Participant

    Thanks Jason. I’ve been using the CSS solution, but I’m getting a FOUC sometimes even on my reasonably fast computer. And the problem with assigning it only to specific pages is that it needs to appear on the search results page, and there’s no “Page” in the back end that corresponds to this. What’s the best solution?

    #13314
    Jason Bobich
    Keymaster

    I’ve been using the CSS solution, but I’m getting a FOUC sometimes even on my reasonably fast computer.

    Hmm, that’s odd. Unlike javascript, a web browser renders CSS instantly. For example, if you were applying some sort of CSS through of a javascript process, then this would make sense.

    You should never see the content unstyled for any moment unless there is an issue pulling the CSS file from the server. The only times I ever see this happen to any webpage are those rare moments when the server stops responding in the middle of trying to load a page. So, I guess what I’m getting at is that maybe there is some other issue going on there.

    And the problem with assigning it only to specific pages is that it needs to appear on the search results page, and there’s no “Page” in the back end that corresponds to this.

    I’m sorry, I guess just don’t understand the issue or what exactly you’re trying to accomplish. This widget area’s content needs to appear on your WordPress site’s search results page? Or you mean in the search engine like Google? You’re saying this is a problem because you want a separate page with the widget area’s content? Sorry I’m just lost I guess.

    #13318
    Robert Piller
    Participant

    I’m not having the FOUC anymore so who knows what that was about. But the question pertains to having the widget area’s content appearing on my WordPress site’s search results page. How might I do that without setting it to appear on all pages? Thanks!

    #13325
    karlo
    Participant

    Can’t you just wrap custom widget code, like from here http://dev.themeblvd.com/tutorial/addremove-widget-area-location/ in is_search() conditional http://codex.wordpress.org/Conditional_Tags#A_Search_Result_Page ? And why not if you can’t? because I think you can.

    Only 2 lines added to the function:

    if ( is_search() ) {
    	echo '<div class="header-right-widget">';
    	themeblvd_display_sidebar( 'header_widget' );
    	echo '</div>';
    }

    Or you can wrap entire themeblvd_add_sidebar_location inside another hook, “wp” perhaps. So nothing happens at all unless on a search results page. If you add is_search() like I did it there is sidebar building action going on, except no output unless on a search results page. Not sure what is best, pretty sure it matters very little.

    Or what about Widget Logic? Does sidebar not become invisible with no widgets? Widget Logic can take conditionals like is_search() Other plugins have GUI for this, like Dynamic Widgets http://wordpress.org/plugins/dynamic-widgets/

    #13326
    karlo
    Participant

    Think I forgot something.

    Is this not what Theme Blvd Widget Areas plugin does?

    Create, then under “Widget Area Assignments”, set “Custom” to is_search() and it will only show up on search pages.

    #13329
    Jason Bobich
    Keymaster

    Aw, I totally didn’t understand what you were trying to do. I thought you meant you wanted the content of the widget area to come up as search results or something. I was totally lost.

    Yeah, do what karlo said. Just use is_search() in the custom conditional for the widget area.

    Or is that not working?

    #13330
    Robert Piller
    Participant

    Ah, sorry, didn’t see that part! Neato. I presume I can select a bunch of pages and then put is_search() in the Custom box to put the widget area on a few pages as well as the search results page. Thanks again.

    #13332
    Jason Bobich
    Keymaster

    I believe so, yes. It is designed to work this way, but sometimes you run into quirks with the conditionals. It’s a newer work-in-progress feature.

Viewing 9 replies - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.