Quantcast
Channel: WordPress.org Forums » All Posts
Viewing all articles
Browse latest Browse all 134847

jaywtee on "Template from scratch: Sidebars not showing widget"

$
0
0

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 -->

[1]: http://wordpress.org/plugins/newsletter/


Viewing all articles
Browse latest Browse all 134847

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>