Redux Framework Part two.

Hi, who is eager to know about redux framework , this post is for you. before following this post you must see the earlier post named get started with redux framework.

Now let’s start, after installing redux framework in you theme according to the previous post,  go to you [sample-config.php] file.

Now scroll bottom to the file and see there is a comment, writing (START SECTIONS) and below the comment see another comment (START Basic Fields), Right below the comment see there is a section writing in php like the picture below.

Screenshot_9

After the section there a lot of sections. You may be do not need all the sections. So just erase all the sections or keep only one section to follow and make sections how much and how much category you need. like the code below.


Redux::setSection( $opt_name, array(
'title' => 'About Options',
'icon' => 'el el-adult',
'fields' => array(
array(
'id' => 'about-heading',
'type' => 'text',
'title' => 'About section Heading',
'desc' =>'Add The Headig of bout section',
'default' => 'ABOUT ME',
),

)
) );

Than see on your dashboard, there is a new option on option menu has been created named [About Options] and a field has been created named [About section Heading] where you will see a text field. here you will write your dynamic title where you call the option.

Now you need to show the title on your theme. So, go to your theme file in which file you want to show like index.php or about.php file.

Before doing this see on the top of the [sample-config.php] there is a variable like this image,

Screenshot_12

This is your option name you need to make global on your theme file. You can change the name from (redux_demo) to any name.

Now make Global in your theme file [index.php] on the top into the body tag like this,
<blockquote>

<?php global $redux_demo; ?>

You have done making global in a file. Remember you have to make global at least one time in a file where you want to apply redux options.

Now call the option field you have created named [About section Heading] . go to a Title on the file where you made global the redux option variable. like this,

<h2>About Me</h2>

Now add the field id of your redux option here, like this,

<h2><?php echo $redux_demo['about-heading']; ?></h2>

Now you have done. save it and go to dashboard and refresh the theme option and save changes. Now go to the theme and refresh it and see the amazing changes.

I’ll come with new post next time,

Enjoy and keep learning.


Leave a Reply