-2

I am trying to hide a sidebar widget in my wordpress theme. I've done what a help site suggests in the sidebar.php file. But when I add a new page I get a parsing error that says this on the right side of the page where the sidebar should be:

Parse error: syntax error, unexpected 'endif' (T_ENDIF), expecting end of file in C:\xampp\htdocs\Rustic1\wp-content\themes\restau\sidebar.php on line 18

<?php
/**
 * The sidebar containing the main widget area.
 *
 * @link https://developer.wordpress.org/themes/basics/template-files/#template-partials
 *
 * @package Restau
 */
?><div id="sidebar">
 <!-- Start widget comment>
 <?php
if ( ! is_active_sidebar( 'sidebar-1' ) ) {
    return;
}
?>
<aside id="sidebar" class="col-md-4 widget-area" role="complementary">
<?php dynamic_sidebar( 'sidebar-1' ); ?>
<?php endif; ?>
<End widget comment -->
</div>
</aside><!-- #sidebar -->

I want the sidebar removed from the entire theme.

trincot
  • 317,000
  • 35
  • 244
  • 286
TT Bird
  • 1
  • 2

1 Answers1

1

You have HTML code between the comment and the next <?php tag. You need to exit PHP mode before the HTML.

<?php
/**
 * The sidebar containing the main widget area.
 *
 * @link https://developer.wordpress.org/themes/basics/template-    files/#template-partials
 *
 * @package Restau
 */
?>
<div id="sidebar">
 <!-- Start widget comment
 <?php
Barmar
  • 741,623
  • 53
  • 500
  • 612