• Resolved neonpixel

    (@neonpixel)


    I’m using a child theme of Ocean WP and registered four widgets in the child theme’s functions.php file. Everything worked fine until the most recent parent theme update, which is replacing the second widget with “left sidebar.”

    I found the offending section of the parent theme’s functions.php and commented out:

    register_sidebar( array(
      'name' => esc_html__( 'Left Sidebar', 'oceanwp' ),
      'id' => 'sidebar-2',
      'description' => esc_html__( 'Widgets in this area are used in the left sidebar region.', 'oceanwp' ),
      'before_widget' => '<div class="sidebar-box %2$s clr">',
      'after_widget' => '</div>',
      'before_title' => '<h4 class="widget-title">',
      'after_title' => '</h4>',
    ) );

    Obviously, this doesn’t follow best practices. I assume I need to de-register the left sidebar in my child theme’s functions.php file but am not very familiar with php yet. What do I need to do to prevent the left sidebar from overriding my widget, in a way that conforms to best practices?

    Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Theme Author oceanwp

    (@oceanwp)

    Hello, you mean you have created four widget area in Appearance Widgets?
    You just need to rename your second widget area, if your ID is “sidebar-2” rename it to “sidebar-two”, this way you will have the Left Sidebar and your custom sidebar.
    Tell me if it works.

    Thread Starter neonpixel

    (@neonpixel)

    Thank you so much for your response! The issue was that I hadn’t declared any IDs for my widgets.

    All I had to do was add IDs to them and add my widgets back.

    Theme Author oceanwp

    (@oceanwp)

    You are most welcome ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How do I stop Ocean WP from overriding child theme widget?’ is closed to new replies.