Widgetize your home page

jdunhin

Active member
Joined
Feb 27, 2013
Messages
72
Best answers
0
Ratings
14
Points
0
#1
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

Well-known member
Joined
Jul 9, 2012
Messages
158
Best answers
0
Ratings
12
Points
18
#2
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

Active member
Joined
Feb 27, 2013
Messages
72
Best answers
0
Ratings
14
Points
0
#3
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

Member
Joined
Jul 7, 2012
Messages
47
Best answers
0
Ratings
5
Points
0
#4
Very details and easy to apply in wordpress theme. thanks for your short tips.
 

jdunhin

Active member
Joined
Feb 27, 2013
Messages
72
Best answers
0
Ratings
14
Points
0
#6
I just like helping people :) Thank you for the kind words!
 
Older Threads
Replies
17
Views
4,021
Replies
16
Views
4,279
Replies
1
Views
1,387
Replies
12
Views
2,719
Newer Threads
Replies
13
Views
4,582
Replies
7
Views
2,637
Replies
13
Views
3,394
Replies
2
Views
1,663
Replies
3
Views
1,816

Sponsors

Latest Blog ArticlesMost Viewed Threads

Tag Cloud

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