VIEW ALL GALLERY LIGHTS

Wednesday, November 4, 2009

How to enable widget function to elements in your blogspot

Many peoples ask me how to insert widgets in elements in blogspot such as sidebar ,main post ,or header in a template . They can't add widgets from Page elements because they see no "Add a widget" link . It mean template is not widget ready .
How to enable widgets function to all element in your blog ? and you can insert widgets in any place you like ?
I explained this in comments for template Simplex Darkness ,and now I write it down here as a tip for any template .
It's very simple .You can see in template files, widget is covered by this tags :
<b:section id='section_id' preferred='yes'>
widget 1
widget 2
widget 3
</b:section>

To enable widget function to a element in blog ,you can add this
<b:section id='section_id' preferred='yes'>
</b:section>

in template file ,where you want to insert widget . For example ,in header, the layout tags of header like this :
<div id="header">
......
content of header
.........
</div>

to insert widget in header ,just insert code above between <div id="header"> and </div> like this

<div id="header">
......
content of header
.........
<b:section id='section_id' preferred='yes'>
</b:section>

</div>

now you can insert widgets in header . The same to other elements such as sidebar or main post ,or footer ...

pay attention to the code
<b:section id='section_id' preferred='yes'>
</b:section>

section_id
is id of section ,it must be unique .
preferred='yes' : mean it will show " Add a widget " link in Page elements . If you set this value 'no' . You will see no link "Add a widget" in Page elements .

Hope this helpful to you

huy signaturesenyumkenyit

No comments:

Post a Comment