Zeaks

layout option

Nov 16th, 2014
273
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.08 KB | None | 0 0
  1. <?php
  2.  
  3.         // Layout options
  4.                 $this->sections[] = array(
  5.                     'icon'   => 'el-icon-cogs',
  6.                     'title'  => __( 'Layout Settings', 'bootville' ),
  7.                     'fields' => array(
  8.                         array(
  9.                             'id'       => 'sidebar_layout',
  10.                             'type'     => 'image_select',
  11.                             'compiler' => true,
  12.                             'title'    => __( 'Main Layout', 'bootville' ),
  13.                             'subtitle' => __( 'Select main content and sidebar alignment. Choose between 1, 2 or 3 column layout.', 'bootville' ),
  14.                             'options'  => array(
  15.                                 '1' => array(
  16.                                     'alt' => '1 Column',
  17.                                     'img' => ReduxFramework::$_url . 'assets/img/1col.png'
  18.                                 ),
  19.                                 '2' => array(
  20.                                     'alt' => '2 Column Left',
  21.                                     'img' => ReduxFramework::$_url . 'assets/img/2cl.png',
  22.                                 ),
  23.                                 '3' => array(
  24.                                     'alt' => '2 Column Right',
  25.                                     'img' => ReduxFramework::$_url . 'assets/img/2cr.png',
  26.  
  27.                                 )
  28.                             ),
  29.                             'default'  => '2'
  30.                         ),     
  31.                     )
  32.                 ); // end Layout Options
  33.  
  34.  
  35.  
  36.  
  37. Basically I want it to use <body <?php body_class(); ?>> if option 1 is selected and use <body <?php body_class('left-sidebar'); ?>> if option 2 is selected. If I just add <div class="<?php echo $pcount; ?>"> it works fine.
  38.  
  39.  
  40. THIS IS THE OPTION ADDED TO THE HEADER -
  41. <?php
  42.     // Sidebar Layout variable from Theme Options
  43.     $pcount = bvwp_option('sidebar_layout');
  44. ?>
  45.            
  46. <body
  47. // Option for sidebar body class
  48. <?php
  49.     if (bvwp_option('sidebar_layout') == '1') {
  50.     body_class();
  51.     if ( $pcount > 2 )
  52.     {
  53.     body_class('right-sidebar');
  54.     }
  55. }
  56. ?>>
Advertisement
Add Comment
Please, Sign In to add comment