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
6,418
Replies
16
Views
6,513
Replies
1
Views
2,337
Replies
12
Views
4,835
Newer Threads
Replies
13
Views
7,208
Replies
7
Views
4,224
Replies
13
Views
6,122
Replies
2
Views
2,770
Replies
3
Views
2,929
Latest Threads
Replies
0
Views
130
Replies
0
Views
66
Replies
0
Views
60
Replies
1
Views
90

Latest postsNew threads

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