jstice4all
jstice4all

Reputation: 1938

How to display a widget on home page?

I want to display subscribe2 plugin's widget on home page. I inserted sidebar into the template:

<div style="display: none">
    <?php get_sidebar('home'); ?>
</div>

<?php get_footer(); ?>

and used the_widget function with Calendar for testing purposes:

<?php the_widget( 'WP_Widget_Calendar' ); ?>

This code shows nothing. So how can I show a widget manually on any page and particularly the subscribe2 widget on front page?

Upvotes: 0

Views: 120

Answers (1)

Anoop Asok
Anoop Asok

Reputation: 1337

Insert the Subscribe2 Plugin's Widget into the Primary Sidebar in the Widget section under the Appearance menu and use the below code to display the Widget anywhere in the template file.

<?php dynamic_sidebar( 'sidebar-1' ); ?>

If you are inserting Widget in Content Sidebar or Footer Widget Area use 'sidebar-2' and 'sidebar-3' respectively in the code.

Upvotes: 1

Related Questions