Created
June 8, 2018 09:58
-
-
Save MarieComet/aa90d2d051b6f6073988de36fe033cb1 to your computer and use it in GitHub Desktop.
Add Divi theme options
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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