Adding a sidebar

PHOTO EMBED

Thu Feb 17 2022 08:17:38 GMT+0000 (Coordinated Universal Time)

Saved by @Prowhiz #php

add_action( 'widgets_init', 'register_main_sidebar' );
function register_main_sidebar() {
  $args = array(
    'name'          => 'Main Sidebar',
    'id'            => 'main-sidebar',
    'description'   => 'This sidebar is shown on the right side of posts and pages',
    'class'         => 'wpdd-main-sidebar',
    'before_widget' => '<li id="%1$s" class="widget %2$s">',
    'after_widget'  => '</li>',
    'before_title'  => '<h2 class="widgettitle">',
    'after_title'   => '</h2>' 
  );
 register_sidebar( $args );
}
content_copyCOPY

Sidebars are another thing that is usually setup by the theme. What I’ve seen online about how to add a sidebar with Oxygen is to use a plugin. I started to set this up with a plugin and then it hit me that this must also be just another WordPress function. This is explained in the WordPress theme handbook. Note that you need to add a widget to the sidebar before trying to add the sidebar to an Oxygen template.

https://www.webtng.com/code-snippets-used-when-creating-an-oxygen-site/