I found some PHP code in a blog tutorial that has enabled widgets in my theme. The code seems like it should work, because since adding it, the widgets option has appeared under the “appearance” tab in the sidebar. The tutorial also provided some code to put in the area that you want the widgets to appear â in my case the footer, which I have included below. Nothing I add in the widgets drag and drop section is showing up, including the titles etc. I have tried adding a few different things and haven’t had any success. There are no errors showing in the console. Does anyone know what might be wrong?
Added to my functions.php
if (function_exists('register_sidebar')) {
register_sidebar(array(
'name' => 'Footer',
'id' => 'footer',
'description' => 'Here you can add widgets to the footer',
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h6>',
'after_title' => '</h6>'
));
}
Added to my footer.php
<?php if (function_exists('dynamic_sidebar') && dynamic_sidebar('widgetized-area')) : else : ?>
<div class="pre-widget">
<p><strong>Widgetized Area</strong></p>
<p>This panel is active and ready for you to add some widgets via the WP Admin</p>
</div>
<?php endif; ?>
My header
<header class="header">
<!-- LOGOS -->
<a href="#">
<img class="standard logo" src="http://www.lucieaverillphotography.co.uk/wp-content/uploads/2015/12/Lucie_Averill_Photography_Logo-2.png">
<img class="white logo" src="http://www.lucieaverillphotography.co.uk/wp-content/uploads/2016/01/Lucie_Averill_Photography_Logo_White.png"></a>
<!-- LOGOS -->
<img class="menu button" src="http://www.lucieaverillphotography.co.uk/wp-content/uploads/2016/01/Menu.png">
<!-- HEADER NAVIGATION MENU -->
<nav class="header-nav">
<div class="menu-header-menu-container">
<ul id="menu-header-menu" class="menu">
<li id="menu-item-463">
<a href="#">WORK</a>
<ul class="sub-menu">
<li id="menu-item-584"><a href="#">LANDSCAPES</a></li>
<li id="menu-item-473"><a href="#">SEASCAPES</a></li>
<li id="menu-item-478"><a href="#">MACRO</a></li>
<li id="menu-item-477"><a href="#">CITIES</a></li>
<li id="menu-item-475"><a href="#">LONG EXPOSURE</a></li>
<li id="menu-item-480"><a href="#">MISCELLANEOUS</a></li>
</ul>
</li>
<li id="menu-item-10"><a href="#">ABOUT</a></li>
<li id="menu-item-464"><a href="#">SHOP</a></li>
<li id="menu-item-923">
<a href="#">SOCIAL</a>
<ul class="sub-menu">
<li id="menu-item-11"><a target="_blank" href="#">FACEBOOK</a></li>
<li id="menu-item-924"><a href="#">INSTAGRAM</a></li>
<li id="menu-item-15"><a target="_blank" href="#">FLICKR</a></li>
</ul>
</li>
<li id="menu-item-14"><a href="#">CONTACT</a></li>
</ul>
</div>
</nav>
</header>
I think the problem is that dynamic_sidebar(); needs to call your registered sidebar by id so:
not
See this and this from the codex