Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress

Jojo Ind
Jojo Ind
2,260 Points

What's the different between "Redux::setSection( $opt_name, array(....)" and "$this->sections[] = array(...)" ?

Hi Treehousers, I'm learning to build wp theme with redux framework theme option. When I generate custom theme from the redux sandbox, the "sample-config.php" give me different code from the "Redux Master" (the master file of Redux that need to be embed to the theme).

My question is : what is the different between :

"Redux::setSection( $opt_name, array(...."

and

"$this->sections[] = array(..."

?

I've read redux doc, but don't quite understand :

http://docs.reduxframework.com/core/sections/getting-started-with-sections/

http://docs.reduxframework.com/core/redux-api/

Thank You

Jo

PS : Here's both code :

// ======= Here's the code from "sample-config.php"

$this->sections[] = array(
                'icon'      => 'el-icon-website',
                'title'     => __('Styling Options', 'redux-framework-demo'),
                'subsection' => true,
                'fields'    => array(
                    array(...


//  =======  The code from Redux Master :

Redux::setSection( $opt_name, array(
        'title'      => __( 'Checkbox', 'redux-framework-demo' ),
        'id'         => 'basic-checkbox',
        'subsection' => true,
        'desc'       => __( 'For full documentation on this field, visit: ', 'redux-framework-demo' ) . '<a href="http://docs.reduxframework.com/core/fields/checkbox/" target="_blank">http://docs.reduxframework.com/core/fields/checkbox/</a>',
        'fields'     => array(...