Widgetize your home page

jdunhin

Active member
Registered
Joined
Feb 27, 2013
Messages
72
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

Well-known member
Joined
Jul 9, 2012
Messages
158
Points
18
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
Registered
Joined
Feb 27, 2013
Messages
72
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

Member
Registered
Joined
Jul 7, 2012
Messages
46
Points
0
Very details and easy to apply in wordpress theme. thanks for your short tips.
 

Holly Nicole

Well-known member
Registered
Joined
Feb 22, 2013
Messages
170
Points
0
Thanks for sharing this it seems like your a WP Master. You make amazing tutorials
 

jdunhin

Active member
Registered
Joined
Feb 27, 2013
Messages
72
Points
0
I just like helping people :) Thank you for the kind words!
 

Holly Nicole

Well-known member
Registered
Joined
Feb 22, 2013
Messages
170
Points
0
Your very welcome I think your tips are amazing and easy to follow
 
Older Threads
Replies
17
Views
5,949
Replies
16
Views
6,150
Replies
1
Views
2,175
Replies
12
Views
4,441
Newer Threads
Replies
13
Views
6,791
Replies
7
Views
3,889
Replies
13
Views
5,638
Replies
2
Views
2,562
Replies
3
Views
2,729
Similar Threads
Replies
5
Views
1,112
Replies
6
Views
1,310
wcq
Replies
8
Views
1,355
Replies
5
Views
2,090
fwh

Latest Hosting OffersNew Reviews

Sponsors

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