Customizing settings & tabs in theme settings

Customizing Theme Config

The settings and tabs in Themify Panel are defined by a series of arrays declared in the file theme-config.php, located in the theme root directory.

Customizing tabs & settings

Customization of theme-config.php definitions to add or remove tabs or settings can be performed in two ways:

  • Overriding the theme-config.php file
  • Using the themify_theme_config_setup filter

Method 1: Overriding the theme-config.php file

Using a custom file is pretty straight forward, you need to:

  1. Create a child theme if you don't have one already.
  2. Copy the theme-config.php file from parent theme to your child theme's folder.
  3. Start adding or removing tabs and modules

Method 2: Using the Filter

You can use the themify_theme_config_setup filter to modify the theme config. For that add this to your child theme's "functions.php" file and then edit the code as desired:


<?php
function theme_themify_theme_config_setup( $arg ) {
	// Unset or add new variable here

	return $arg;
};
add_filter('themify_theme_config_setup', 'theme_themify_theme_config_setup');

?>

Example

Remove General and Default Layouts side tabs


<?php
unset($arg['panel']['settings']['tab']['general']);
unset($arg['panel']['settings']['tab']['default_layouts']);
?>

Add new side tab with modules


<?php
$arg['panel']['settings']['tab']['new_layouts'] = array(
	'title' => 'New Layouts',
	'custom-module' => array(
		array(
			'title' => 'New Index Layout (archive, category, search, tag pages, etc.)',
			'function' => 'default_layout'
		),
		array(
			'title' => 'New Post Layout (single post)',
			'function' => 'default_post_layout'
		)
	)
);
?>

Complete code:


<?php
function theme_themify_theme_config_setup( $arg ) {
	// Unset or add new variable here

	return $arg;
};
add_filter('themify_theme_config_setup', 'theme_themify_theme_config_setup');

?>

<?php
unset($arg['panel']['settings']['tab']['general']);
unset($arg['panel']['settings']['tab']['default_layouts']);
?>

<?php
$arg['panel']['settings']['tab']['new_layouts'] = array(
	'title' => 'New Layouts',
	'custom-module' => array(
		array(
			'title' => 'New Index Layout (archive, category, search, tag pages, etc.)',
			'function' => 'default_layout'
		),
		array(
			'title' => 'New Post Layout (single post)',
			'function' => 'default_post_layout'
		)
	)
);
?>

<?php
function theme_themify_theme_config_setup($arg) {

	// remove Setting General and Default Layout Tab
	unset($arg['panel']['settings']['tab']['general']);
	unset($arg['panel']['settings']['tab']['default_layouts']);

	// add new settings options
	$arg['panel']['settings']['tab']['new_layouts'] = array(
		'title' => 'New Layouts',
		'custom-module' => array(
			array(
				'title' => 'New Index Layout (archive, category, search, tag pages, etc.)',
				'function' => 'default_layout'
			),
			array(
				'title' => 'New Post Layout (single post)',
				'function' => 'default_post_layout'
			)
		)
	);

	return $arg;
};
add_filter('themify_theme_config_setup', 'theme_themify_theme_config_setup');
?>

The Pagespeed Beta now available. Feel the lightning speed.