Template from scratch: Sidebars not showing widget
-
I have an issue wherein i have a plugin ([newsletter][1]) which has a widget whereby users can (usually) subscribe to a newsletter and other functionality.
But i digress.
I have been trying to create my own wordpress template solely for personal-use. The following is the code I’ve accumulated in progression to having a functional sidebar, but so far, un-successful. Any help is much appreciated. Thanks
index.php
<div id="content" class="alignCenter"> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <?php the_content(); ?> <?php endwhile; endif; ?> </div> <?php get_sidebar(); ?>
functions.php
<?php /** * Register our sidebars and widgetized areas. * */ function arphabet_widgets_init() { register_sidebar( array( 'name' => 'Home right sidebar', 'id' => 'home_right_1', 'before_widget' => '<div>', 'after_widget' => '</div>', 'before_title' => '<h2 class="rounded">', 'after_title' => '</h2>', ) ); } add_action( 'widgets_init', 'arphabet_widgets_init' ); ?>
sidebar.php ( taken from twentyfourtine theme )
<?php /** * The Sidebar containing the main widget area * * @package WordPress * @subpackage Twenty_Fourteen * @since Twenty Fourteen 1.0 */ ?> <div id="secondary"> <?php $description = get_bloginfo( 'description', 'display' ); if ( ! empty ( $description ) ) : ?> <h2 class="site-description"><?php echo esc_html( $description ); ?></h2> <?php endif; ?> <?php if ( has_nav_menu( 'secondary' ) ) : ?> <nav role="navigation" class="navigation site-navigation secondary-navigation"> <?php wp_nav_menu( array( 'theme_location' => 'secondary' ) ); ?> </nav> <?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; ?> </div><!-- #secondary -->
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Template from scratch: Sidebars not showing widget’ is closed to new replies.