0

I'm trying to install a sidebar in my custom-theme.

functions.php:

<?php
  /**
   * Register our sidebars and widgetized areas.
   *
   */
  function arphabet_widgets_init() {

    register_sidebar( array(
      'name'          => 'sidebar',
      'id'            => 'sidebar',
      'before_widget' => '<div>',
      'after_widget'  => '</div>',
      'before_title'  => '<h2 class="rounded">',
      'after_title'   => '</h2>',
    ) );

  }

  add_action( 'widgets_init', 'arphabet_widgets_init' );

?>

sidebar.php:

<div class="sidebar">
  <?php if ( is_active_sidebar( 'sidebar' ) ) : ?>
    <div id="sidebar" class="primary-sidebar widget-area" role="complementary">
      <?php dynamic_sidebar( 'sidebar' ); ?>
    </div><!-- #primary-sidebar -->
  <?php endif; ?>
</div>

On my widgets page in the admin area I now see a widget box called sidebar and i've put a Custom Menu in it. I've also given the div .sidebar a colour in CSS.

but i don't see anything on the website itself. Any idea what i'm missing?

muescha
  • 1,544
  • 2
  • 12
  • 22
Erin
  • 85
  • 2
  • 13
  • update: I've included at the end of sidebar.php, and my index.php now looks like this: Now the sidebar shows up (yay!) but not the content! And if I put the after the content, the content displays but not the sidebar... Any suggestions? – Erin Mar 17 '17 at 16:29
  • I'll put this in a new question as it's very confusing without breaks... – Erin Mar 17 '17 at 16:32
  • please explain: ` don't see anything. please inspect the html returned from server. (A) is the html code for the sidebar in html -> it is a css problem (B) no html code -> it is a php/wordpress problem – muescha Mar 17 '17 at 17:11
  • try to change the id (maybe some id name issues http://wordpress.stackexchange.com/questions/59973/what-is-allowed-as-an-id-argument-in-register-sidebar-args/59985#59985 ) – muescha Mar 17 '17 at 17:11
  • and i see here the name of the id in ` – muescha Mar 17 '17 at 17:17

0 Answers0