I'm using the very popular Elementor theme to build my WordPress site, but unfortunately there is not a Widgets option when I go to Appearance in the Dashboard:
I need it in order to create a sidebar.
So this has caused me to install a Child Theme, so that I can add some code to functions.php
in order to get the widgets option to show.
This is what I have in my functions.php
file for the child theme:
<?php
add_action( 'wp_enqueue_scripts', 'enqueue_parent_styles' );
function enqueue_parent_styles() {
wp_enqueue_style( 'parent-style', get_template_directory_uri().'/style.css' );
}
add_action('widgets_init', 'outWidgetsInit');
function ourWidgetsInit() {
register_sidebar( array (
'name' => 'Sidebar',
'id' => 'sidebar1',
));
}
And this is causing errors to show at the top of the theme while developing:
Why is the code showing at the top of the screen? What should I do differently here?
functions.php
file? Or just what you added?functions.php
file for the child theme, yes.functions.php
that could do this, the problem is elsewhere