Widgetize your home page

jdunhin

New member
Joined
Feb 27, 2013
Messages
93
Points
0
Put this code in your functions.php file
PHP:
<?php
add_action( 'widgets_init', 'my_register_sidebars' );

function my_register_sidebars() {

	/* Register the 'homepage' sidebar. */
	register_sidebar(
		array(
			'id' => 'home',
			'name' => __( 'home' ),
			'description' => __( 'Widget on home page' ),
			'before_widget' => '<div id="%1$s" class="widget %2$s">',
			'after_widget' => '</div>',
			'before_title' => '<h3 class="widget-title">',
			'after_title' => '</h3>'
		)
	);?>
Make a custom home page template and put this code in.
HTML:
		<div id="sidebar-home" class="sidebar">
       	   	<?php dynamic_sidebar( 'home' ); ?>
		</div>
This is very fast method and I use this code allot!
 

Jack London

New member
Joined
Jul 9, 2012
Messages
386
Points
0
Hi Jdunhin, good tutorial for create a widget on homepage. what can I put into that widget in wp-admin ? is it custom text widget in wordpress ?
 

jdunhin

New member
Joined
Feb 27, 2013
Messages
93
Points
0
Thank you :)

You can put in any kind of widget into that widget area! I usually put Query Posts on or basically any kind of widget.
 

Dmoz

New member
Joined
Jul 7, 2012
Messages
122
Points
0
Very details and easy to apply in wordpress theme. thanks for your short tips.
 

jdunhin

New member
Joined
Feb 27, 2013
Messages
93
Points
0
I just like helping people :) Thank you for the kind words!
 
Older threads
Replies
17
Views
5,674
Replies
17
Views
5,824
Replies
4
Views
3,340
Newer threads
Replies
12
Views
8,208
Replies
6
Views
5,347
Replies
0
Views
1,988
Replies
49
Views
21,029
Latest threads
Replies
3
Views
130
Replies
0
Views
173
Replies
3
Views
310
Recommended threads
Replies
3
Views
2,685
Replies
0
Views
2,444
Replies
1
Views
2,429

Latest postsNew threads

Referral contests

Referral link for :

Sponsors

Popular tags

You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an alternative browser.

Top