WordPress.org

Forums

Pinboard
pinboard_sidebar_class() - Maybe bugged (1 post)

  1. thomasmorkeberg
    Member
    Posted 1 year ago #

    Hello.

    Im sorry, but my english is not that good in writing :)

    I love your theme and have learned alot about HTML5 & CSS3 by editing it.

    My problem is that my page got bugged when i set the 'preferred Layout' to 'Full Width', and some of the site templates to 'content-sidebar'.
    - The bug is that the sidebar gets class="twocol" instead of class="threecol".

    When i set the 'preferred Layout' to 'Content/Sidebar' then the sidebar gets the right class - class="threecol".

    When I look at the function 'pinboard_sidebar_class()' it makes sense.

    function pinboard_sidebar_class( $classes = array() ) {
    	$classes[] = 'column';
    	if( 'content-sidebar-half' == pinboard_get_option( 'layout' ) || 'sidebar-content-half' == pinboard_get_option( 'layout' ) || 'content-sidebar-half' == pinboard_get_option( 'layout' ) || is_page_template( 'template-content-sidebar-half.php' ) || is_page_template( 'template-sidebar-content-half.php' ) )
    		$classes[] = 'twocol';
    	else {
    		if( 2 == pinboard_get_option( 'layout_columns' ) || is_page_template( 'template-content-sidebar.php' ) )
    			$classes[] = 'twocol';
    		elseif( 3 == pinboard_get_option( 'layout_columns' ) || is_page_template( 'template-content-sidebar.php' ) )
    			$classes[] = 'threecol';
    		elseif( 4 == pinboard_get_option( 'layout_columns' ) )
    			$classes[] = 'fourcol';
    	}
    	echo 'class="' . implode( ' ', $classes ) . '"';
    }

    When 'is_page_template' isn't set it will choise from 'pinboard_get_option( 'layout_columns' )', and select the right class.
    When 'is_page_template' is set to 'template-content-sidebar.php', it will choice the first 'If' with that option, which gives the wrong class.

    Should your 'pinboard_sidebar_class()' not look like this instead:

    function pinboard_sidebar_class( $classes = array() ) {
    	$classes[] = 'column';
    	if( 'content-sidebar-half' == pinboard_get_option( 'layout' ) || 'sidebar-content-half' == pinboard_get_option( 'layout' ) || 'content-sidebar-half' == pinboard_get_option( 'layout' ) || is_page_template( 'template-content-sidebar-half.php' ) || is_page_template( 'template-sidebar-content-half.php' ) )
    		$classes[] = 'twocol';
    	else {
    		if( 2 == pinboard_get_option( 'layout_columns' ) || is_page_template( 'template-content-sidebar-half.php' ) )
    			$classes[] = 'twocol';
    		elseif( 3 == pinboard_get_option( 'layout_columns' ) || is_page_template( 'template-content-sidebar.php' ) )
    			$classes[] = 'threecol';
    		elseif( 4 == pinboard_get_option( 'layout_columns' ) )
    			$classes[] = 'fourcol';
    	}
    	echo 'class="' . implode( ' ', $classes ) . '"';
    }

    At least that ^^ fixed the problem for me :)

Topic Closed

This topic has been closed to new replies.

About this Theme

About this Topic

  • RSS feed for this topic
  • Started 1 year ago by thomasmorkeberg
  • This topic is not resolved
  • WordPress version: 3.5.1