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.

Filtering sidebar width is snuffing out other sidebar layouts

  • Creator
    Topic
  • #19633
    timworx
    Participant

    I’m resizing the column widths in a sidebar and I noticed that it is knocking out all of the other layouts. I’m using:

    function my_sidebar_widths() {
    	$layouts['sidebar_right']['columns'] = array(
    				'content' 	=> 'span9',
    				'left' 		=> '',
    				'right' 	=> 'span3'
    			);
    	return $layouts;
    }
    add_filter('themeblvd_sidebar_layouts', 'my_sidebar_widths');

    Which seems to be proper and is the same as the column sizing examples, AFAIK. Any thoughts? I swear I’ve done this before and don’t recall having this issue.
    Thanks!

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

    Hi,

    When you say it’s “knocking out all of the other layouts” — What do you mean exactly? And what version of Jump Start are you using?

    #19639
    timworx
    Participant

    Older 1.x version.

    Sorry, that problem was very, very vague. I did some more testing so I can better describe exactly what it’s doing. It’s removing them from the options of `Sidebar Layouts` in both the Builder AND on the Pages. It makes it so that I have the `Default Sidebar Layout` as the only option.

    Changing the default sidebar in the `Theme Options` does change the default sidebar. However, with a left sidebar for example, it leaves out the necessary `span4` from div.fixed-sidebar.left-sidebar.

    I’ve tried it with plugins deactivated and with all other added filter and actions in functions.php commented out and the code pertaining to the column resizing (as listed above) is the only thing with an effect.

    Do I have to recreate the entire layout array rather for the filter?

    #19646
    Jason Bobich
    Keymaster

    Aww, I see what’s wrong with your code. You’re not declaring your function correctly, and this is breaking everything. The first line of your code, the declaration of the function, needs to be setup for the $layouts argument.

    function my_sidebar_widths( $layouts ) {

    The point of a filter is that you’re passing a variable that you want to change. Then you make changes to it, then return it again. But in your case, your starting from an empty $layouts variable, because you’re not passing the original one in, which you are aiming to edit.

    #19649
    timworx
    Participant

    Ahhhhhh. I was wondering how it would alter it without replacing it. I just left off on “must be WP magic”.

    That makes a hell of a lot more sense. You’re the man.

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