Redux WP

Introduction

File Structure

theme/
├── assets/
│   └── css/
│       └── admin/
│           └── redux.css
└── inc/
│   ├── redux/
│   │   ├── redux.php
│   │   ├── config.php
│   │   └── sections.php  
│   └── options.php
└── functions.php

Step 1: Install Redux WP Framework Plugin

Redux WP Framework Plugin

Step 2: Include php files

Include this code to functions.php file

/**
 * Theme Init
 */
require_once get_theme_file_path( '/inc/init.php' );

Include this code to /inc/init.php file

/**
 * Theme Options
 */
require_once get_theme_file_path( '/inc/options.php' );

/**
 * Redux Framework Config
 */
require_once get_theme_file_path( '/inc/redux/redux.php' );

Step 3: Setup Redux Config

https://docs.redux.io/
https://docs.reduxframework.com/

Step 4: Set Section and Fields

/** Section Name */
Redux::setSection( $opt_name, array(
	'title'      => esc_html__( 'Section Name', 'textdomain' ), // Section title
	'id'         => 'section-id', // Section id
	'icon'       => 'el el-cog', // Elusive icons, http://elusiveicons.com/icons/
	'heading'    => esc_html__( 'Heading', 'textdomain' ), //Text to appear at the top of the section page. 
	'desc'       => 'This is the section description. HTML is permitted.',
	//'subsection' => true, This section should appear as a subsection to the previously defined section.
	'fields'     => array(
		/** Field Name */
		array(
			'id'       => 'field-id',
			'type'     => 'text', // switch
			'title'    => esc_html__( 'Field title', 'textdomain' ),
			'subtitle' => esc_html__( 'Field subtitle', 'textdomain' ),
			'default'  => '', // Default value for the field. For switch can use bool true
			'class'    => 'class-name', // Appends any number of classes to the field's class attribute.
			'required' => array(
				'field-id', // Required field id
				'equals', // https://docs.redux.io/configuration/fields/required.html#operations-available
				true, // Value
			),
		),
		/** Field Name Two */
		array(
			'id'       => 'field-id-2',
			'type'     => 'text', // switch
			'title'    => esc_html__( 'Field title', 'textdomain' ),
			// multiple "parent" required values
			'required' => array( 
				array( 'LINKED_FIELD_ID_1', 'OPERATION_1', 'VALUE_1' ), 
				array( 'LINKED_FIELD_ID_2', 'OPERATION_2', 'VALUE_2' ) 
			)
		),
	),
) );

Step 4: Get Value

bootwp_get_option( 'field-id' ); // return
bootwp_option( 'field-id' ); // display

if ( bootwp_get_option( 'field-id' ) ) {
	echo bootwp_option( 'field-id' );
}

// Convert line break to <br>
echo nl2br( astex_get_option( 'footer-title') )