Enable or Disable Section By Option Tree

in theme-options.php

array(
‘label’       => ‘Enable slider’,
‘id’          => ‘pp_slider_on’,
‘type’        => ‘select’,
‘desc’        => ‘Show slider on homepage’,
‘choices’     => array(
array(
‘label’       => ‘Yes’,
‘value’       => ‘yes’
),
array(
‘label’       => ‘No’,
‘value’       => ‘no’
)
),
‘std’         => ‘yes’,
‘rows’        => ”,
‘post_type’   => ”,
‘taxonomy’    => ”,
‘class’       => ”,
‘section’     => ‘homepage’
),

 

And in front-end add this —

<?php
$sliderstatus = ot_get_option( ‘pp_slider_on’ );
if($sliderstatus == ‘yes’) {
get_template_part(‘slider’);
}
?>

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.

Up ↑

%d bloggers like this: