I am writing a wordpress theme, help, please, find out why I don’t appear on the sidebar site, although it appears in the admin area, I fill it up and save it (the "save" button). And on the site it is not displayed ... PS: the functions and code NOT associated with the sidebar I did not write

header.php:

<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"> <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous"> <!-- Font-awesome --> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css"> <link rel="stylesheet" href="<?php echo esc_url( get_template_directory_uri() ); ?>/style/mystyle.css"/> <link rel="stylesheet" href="<?php echo esc_url( get_template_directory_uri() ); ?>/style.css"/> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script> <title><?php wp_title (" "); ?> <?php if (wp_title (" ", false)) { echo " | "; } ?><?php bloginfo ("name"); ?></title> <?php wp_head(); ?> </head> <body> <!-- All content on the page --> <div id="cont"> 

index.php:

 <?php get_header(); ?> <div> Some content </div> <?php get_sidebar(); ?> <?php get_footer(); ?> 

function.php:

 if (function_exists('register_sidebar')) { register_sidebar(array( 'name' => 'Right sidebar', 'before_widget' => '<div class="widget">', 'before_title' => '<h2 class="sidebar-header">', 'after_title' => '</h2><div class="text">', 'after_widget' => '</div></div><hr/>' )); } 

sidebar.php:

  <?php if ( !function_exists('dynamic_sidebar') || !is_dynamic_sidebar(1) ) : endif; ?> 

footer.php:

  <h1>FOOTER</h1> <script src="https://code.jquery.com/jquery-3.1.1.slim.min.js" integrity="sha384-A7FZj7v+d/sdmMqp/nOQwliLvUsJfDHW+k9Omg/a/EheAdgtzNs3hpfag6Ed950n" crossorigin="anonymous"> </script> <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"> </script> </div> </body> 

    1 answer 1

    You do not have widget code in sidebar.php . Correct the following code.

    sidebar.php:

      <?php if ( is_dynamic_sidebar() ) : dynamic_sidebar(); endif; ?>