Make your theme Widget Ready
WP Tutorial: How to make your theme Widget Ready
Wordpress has thousands of themes, of course, there are a considerable number of them do not support the widget tools to the sidebar, only through the code to modify. People can not help asking: How can I make the theme of our support for this widget? Can not find on google, or I have to write it ~
First of all, what are Widgets?
Almost half of the theme is support for widgets, and it is not a very difficult task. Widgets are small, you can add the wordpress control panel background to the sidebar (sidebar). Common widgets including the most recent articles, recent comments, categories and so on. WP2.7 you can in the Control Panel, click Appearance> widgets gadget settings to open the page.
How to achieve the theme of Widgets?
This process is very simple, perhaps too simple, wordpress theme will be so popular with Widgets.
Step One:
First of all, open the functions.php file, if the subject does not, please manually create, insert the following to ensure it is in labels.
if (function_exists ( ‘register_sidebar’))
register_sidebar (array (
‘Name’ => ’sidebar’,
‘before_widget’ => ‘<div>’,
‘After_widget’ => ‘</ div>’,
‘Before_title’ => ‘<h2>’,
‘After_title’ => ‘</ h2>’,
));
It is not difficult to find their own interpretation of a section of code, function is to create a widget-ready areas, and named for the sidebar, at the same time provides for Widgets which will run in the region, such as what appears in the Widgets, before which they appear in the following .
When using the Widget will be used when the following code:
<div>
<h2> Title Here ( “Recent Posts”, for example) </ h2>
Widget content is here, like a list of recent posts for example.
</ div>
So you can customize the widget’s border, title, etc., of course, now you can also use CSS to change the widget’s style, great bar.
Step Two:
The completion of earlier steps, save the file, and then open the sidebar.php, you show the widgets in place to paste the following code:
<? php if (! function_exists ( ‘dynamic_sidebar’) | |! dynamic_sidebar ( “sidebar”)):?>
<? php endif;?>
Make sure dynamic sidebar name in content is the same as you just set in function.php.
Learned to add widgets, you can add more than one sidebar widget, can add a header used to display ads, the footer shows the recent articles and reviews, of course, this is only recommended. Not always limited to the widget on the side, they really can be on any place you want.
If you have a better way,leave a here to share!
Popularity: 24% [?]
No trackbacks yet.
How to fix parsing error of WordPress Feed for XML
about 4 months ago - No comments
When I happened to visit my Rss,I found my XML went to some problem.It said like below
XML parsing error: xml processing instruction not in the beginning of an external entity
Location: http://www.tiham.com/feed/
Line: 2, column: 3
Reasons: Generally,it is caused by the empty line of the first line of XML file.
Solution:
* Check the wp-config.php file to see if More >
How to hide your Affiliate link
about 6 months ago - No comments
If you are doing Affiliate Business,you might know affiliate link.That is for you to promote your stuff on the sites.It contains a code that links to your interest.But the Affiliate links are always too long not easy to remember and people often do not like to click other’s affiliate links,I do not know why.In this More >



















about 6 months ago
Interesting, I`ll quote it on my site later.
Thank you
about 6 months ago
Thanks for your comment.
about 6 months ago
Hi,
Ugh, I liked! So clear and positively.
Dirnov
about 6 months ago
Thanks for your comment.I will post more helpful content here.Please keep update with me.
about 6 months ago
Can i get a one small pic from your blog?
Thanks
Elcoj
about 6 months ago
I am glad that you want a small pic from my blog.please go ahead.Wish it helpful.
about 6 months ago
Greatings, Ugh, I liked! So clear and positively.
Thanks
about 5 months ago
Greatings, Onload of page my antivirus put alert, check pls.
Thanks
about 5 months ago
Thanks for your comment.I did not find anything goes wrong.My McAfee did not put any alert about this page.Anyway,Thanks
about 5 months ago
Hello,
http://www.sinoyan.com – da best. Keep it going!
Eremeeff
about 5 months ago
Thanks,I will try all my best to do it.