Greetings,
I am attempting to learn how to build custom themes in WordPress and have reached a point where I think I have a typo however am not sure. My challenge is my index.php file works as I anticipated it would. My attempts to add more content does not. Widgets do not appear in the sidebar as desired however the footer works as anticipated.
Internally in live view I get the message:
There are no widget areas currently rendered in the preview. Navigate in the preview to a template that makes use of a widget area in order to access its widgets here.
Any changes to the sidebar I make through widgets display correctly in index.php. Ionly have one plugin installed it is: Query Monitor I have included what I think may be helpful below.
Here is the code I have in my theme.
Wordpress 4.6.1
functions.php
<?php /*
Theme Name: The Jacksonville Marketplace
Theme URI: #
Description: Jacksonville Marketplace Functions.php
Version: 1.0
Author: JAX Computers
Author URI:
http://www.website-design-jacksonville.com/
*/
?>
<?php
/* default sidebar */
add_action( 'widgets_init', 'child_register_sidebar1' );
function child_register_sidebar1(){ register_sidebar(array(
'name' => 'Default Sidebar',
'id' => 'sidebar-1',
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h4 class="widgettitle">',
'after_title' => '</h4>',
));
}
/* fooer one */
add_action( 'widgets_init', 'child_register_sidebar' );
function child_register_sidebar(){ register_sidebar(array(
'name' => 'Footer Widget 1',
'id' => 'sidebar-2',
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h4 class="widgettitle">',
'after_title' => '</h4>',
));
}
/* footer two */
add_action( 'widgets_init', 'child_register_sidebar2' );
function child_register_sidebar2(){ register_sidebar(array(
'name' => 'Footer Widget 2',
'id' => 'sidebar-3',
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h4 class="widgettitle">',
'after_title' => '</h4>',
));
}
/* footer three */
add_action( 'widgets_init', 'child_register_sidebar3' );
function child_register_sidebar3(){ register_sidebar(array(
'name' => 'Footer Widget 3',
'id' => 'sidebar-4',
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h4 class="widgettitle">',
'after_title' => '</h4>',
));
}
add_theme_support( 'nav-menus' );
add_action( 'init', 'register_my_menus' );
function register_my_menus() {
register_nav_menus(
array(
'primary-menu' => __( 'Primary Menu' ),
'secondary-menu' => __( 'Secondary Menu' )
)
);
}
sidebar.php
<?php
/**
* The template for the sidebar containing the main widget area
*
* @package WordPress
* @subpackage Jacksonville Marketplace
*/
?>
<?php /* if ( is_active_sidebar( 'sidebar-1' ) ) : ?>
<aside class="sidebar widget-area" role="complementary">
<?php dynamic_sidebar( 'sidebar-1' ); ?>
</aside><!-- .sidebar .widget-area -->
<?php endif; */?>
<?php if ( is_active_sidebar( 'sidebar-1' ) ) : ?>
<div id="primary-sidebar" class="primary-sidebar widget-area" role="complementary">
<?php dynamic_sidebar( 'sidebar-1' ); ?>
</div><!-- #primary-sidebar -->
<?php endif; ?>
Index
http://www.thejacksonvillemarketplace.com/
<?php
/**
* The main template file
*
* The Jacksonville Marketplace Theme
*
*/
get_header(); ?>
<div class="row main-content">
<div class="coffee-span-8 content coffee-800-span-12">
<div class="subgrid content">
<div class="row">
<div class="coffee-span-12">
<p class="paragraph p-1"><a title="The Jacksonville Marketplace" href="http://www.jaxmarket.com/" target="_blank" class="paragraph-text-1">The Jacksonville Marketplace</a> is a secure on-line shopping mall. We feature a growing list of merchants interested in doing business with you.</p>
</div>
</div>
<div class="row">
<div class="coffee-span-12">
<h1 class="heading-1">The Jacksonville Marketplace Blog</h1>
<p class="paragraph p-1">The Jacksonville Market Place Bog is the primary blog for The Jacksonville Market Place On-Line Mall. This extension of the mall is for you the customer to see the latest news, products and services offered by our merchants. Your feedback to our merchants is highly valued by our merchants. Feel free to browse our categories and read the latest news.</p>
<ul class="unorder-list unordered-list-1">
<li class="content-li">Secure Storefronts</li>
<li class="content-li">Multiple Stores</li>
<li class="content-li">Multiple Payment Options</li>
<li class="content-li">No personal information stored on-site.</li>
<li class="content-li">Always open and ready to take orders.</li>
</ul>
</div>
</div>
</div>
</div>
<aside class="coffee-span-4 sidebar coffee-800-span-12" id="sidebar-1">
<?php
if ( is_active_sidebar(1) ) {
?>
<?php dynamic_sidebar( 'sidebar-1' );
?>
<?php
} else {
?>
Default Side Bar
<?php
};
?>
</aside>
</div>
<?php get_footer(); ?>
Home
http://www.thejacksonvillemarketplace.com/home/
<!--more-->
<div class="row main-content">
<div class="coffee-span-8 content coffee-800-span-12">
<div class="subgrid content">
<div class="row">
<div class="coffee-span-12">
<p class="paragraph p-1"><a title="The Jacksonville Marketplace" href="http://www.jaxmarket.com/" target="_blank" class="paragraph-text-1">The Jacksonville Marketplace</a> is a secure on-line shopping mall. We feature a growing list of merchants interested in doing business with you.</p>
</div>
</div>
<div class="row">
<div class="coffee-span-12">
<h1 class="heading-1">The Jacksonville Marketplace Blog</h1>
<p class="paragraph p-1">The Jacksonville Market Place Bog is the primary blog for The Jacksonville Market Place On-Line Mall. This extension of the mall is for you the customer to see the latest news, products and services offered by our merchants. Your feedback to our merchants is highly valued by our merchants. Feel free to browse our categories and read the latest news.</p>
<ul class="unorder-list unordered-list-1">
<li class="content-li">Secure Storefronts</li>
<li class="content-li">Multiple Stores</li>
<li class="content-li">Multiple Payment Options</li>
<li class="content-li">No personal information stored on-site.</li>
<li class="content-li">Always open and ready to take orders.</li>
</ul>
</div>
</div>
</div>
</div>
<aside class="coffee-span-4 sidebar coffee-800-span-12" id="sidebar-1">
<?php
if ( is_active_sidebar(1) ) {
?>
<?php dynamic_sidebar( 'sidebar-1' );
?>
<?php
} else {
?>
Try Again Ed
<?php
};
?>
</aside>
</div>
Contact
http://www.thejacksonvillemarketplace.com/contact-us/
<div class="row main-content">
<div class="coffee-span-8 content coffee-800-span-12">
<h1 class="content-h1">Give us a shout</h1>
<div class="html-element form">
<script type="text/javascript">document.write(unescape("%3Cscript src='http" + (document.location.protocol == 'https:' ? 's' : '') + "
/www.coffeecup.com/api/sdrive/forms/form.js?name=JAXform%26slug=324174%26height=820%26crossdomains=true%26rand=" + Math.floor( Math.random() * 1000000000 ) + "' type='text/javascript'%3E%3C/script%3E"));</script>
</div>
</div>
<aside class="coffee-span-4 sidebar coffee-800-span-12" >
<?php
if ( is_active_sidebar(1) ) {
?>
<?php dynamic_sidebar( 'sidebar-1' ); ?>
<?php
} else {
?>
Nope this isn't correct either Ed
<?php
};
?>
</aside>
</div>
<?php get_sidebar(); ?>
Query Monitor
widgets_init 10 child_register_sidebar1()
wp-content/themes/jacksonvillemp/functions.php:16 Theme
10 child_register_sidebar()
wp-content/themes/jacksonvillemp/functions.php:29 Theme
10 child_register_sidebar2()
wp-content/themes/jacksonvillemp/functions.php:42 Theme
10 child_register_sidebar3()
wp-content/themes/jacksonvillemp/functions.php:55 Theme
100 WP_Widget_Factory->_register_widgets()
wp-includes/class-wp-widget-factory.php:136 Core
register_sidebar
wp_register_sidebar_widget