Skip to content

Instantly share code, notes, and snippets.

@MarieComet
Created June 8, 2018 09:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MarieComet/aa90d2d051b6f6073988de36fe033cb1 to your computer and use it in GitHub Desktop.
Save MarieComet/aa90d2d051b6f6073988de36fe033cb1 to your computer and use it in GitHub Desktop.
Add Divi theme options
if ( is_admin() ) {
add_filter( 'et_epanel_layout_data', 'custom_et_epanel_layout_data' );
}
/**
* Hooked into the et_epanel_layout_data filter
* Add additional social media options to the Divi Theme Options panel
*
* @param $options
*
* @return array
*/
function custom_et_epanel_layout_data( $options ) {
// original Divi theme options
$original_options = $options;
// our custom options
$new_options = array();
// loop on original options
foreach ( $original_options as $option ) {
// build new options array
$new_options[] = $option;
if ( ! isset( $option['id'] ) ) {
continue;
}
// select our option position (below existing option, here logo)
if ( 'divi_logo' === $option['id'] ) {
$new_options[] = array(
'name' => esc_html__( 'Second logo', 'divi' ),
'id' => 'divi_second_logo',
'type' => 'upload',
'desc' => esc_html__( 'Logo secondaire', 'divi' ),
);
}
}
$options = $new_options;
return $options;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment