Created
December 31, 2019 09:44
-
-
Save litonarefin/f8c0dc9f480d2cab2a76279103a268b7 to your computer and use it in GitHub Desktop.
Add External Image option for Backgrounds
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
extend the Group Control Base in my plugin to create an external background image option field to go with the standard classic background options. | |
class Group_Control_Background_trchristensen extends Group_Control_Background { | |
public function init_fields() { | |
$fields = parent::init_fields(); | |
//here you add your field | |
$fields['ext_image'] = [ | |
'label' => _x( 'External Image', 'Background Control', 'elementor' ), | |
'type' => Controls_Manager::TEXT, | |
'title' => _x( 'Background Image', 'Background Control', 'elementor' ), | |
'selectors' => [ | |
'{{SELECTOR}}' => 'background-image: url("{{URL}}");', | |
], | |
'condition' => [ | |
'background' => [ 'classic' ], | |
], | |
]; | |
return $fields; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment