How To Add Page Elements to Posts Column and Blog Header

Posted by Lasantha Bandara on March 29th, 2009 File Under : change template0 Comment
Blogger gives a method to add Page Elements to the sidebars of your blog. You have to login to Blogger.com and click on Layout link on Dashboard and then click on 'Add a Page Element' link at the top of the sidebar.

However, there is no method to add Page Elements to the posts column or the Header and the Footer of the blog. There is a workaround for this. Page Elements are represented in the new Blogger Layout templates by widget codes. For example your Blog Header Page Element widget code looks like this :

<b:widget id='Header1' locked='true' title='MY BLOG (Header)' type='Header'/>

You can see this by login at Blogger.com and click on Layout link on Dashboard. Then click Edit Html subtab of Template tab. Scroll down in Template code box to see above code. This code is wrapped in the Header section code like this :

<b:section class='header' id='header' maxwidgets='1' showaddelement='no'>
<b:widget id='Header1' locked='true' title='MY BLOG (Header)' type='Header'/>
</b:section>

As you can see in the first line the number of maximum widgets in the header section is set to one. This makes it impossible for you to add new widgets in the header. Also Showaddelement is set to No.

To add more page elements in header change this code to :

<b:section class='header' id='header' maxwidgets='3' showaddelement='yes'>
<b:widget id='Header1' locked='true' title='MY BLOG (Header)' type='Header'/>
</b:section>

Set the maxwidgets to the number of widgets you want to put in the header section plus one. This makes it easier to rearrange the widget order in the header. Also change showaddelement to Yes. This will add a "Add Page Element' link to the header on the Layouts page.

You can do the same with the Blog Posts section code :

<b:section class='main' id='main' showaddelement='no'>
<b:widget id='Blog1' locked='true' title='Blog Posts' type='Blog'/>
</b:section>

Change this to as below:

<b:section class='main' id='main' showaddelement='yes'>
<b:widget id='Blog1' locked='true' title='Blog Posts' type='Blog'/>
</b:section>

Add a maxwidgets=x code and change showaddelement to yes. Save Template and click on Page Elements subtab of Template tab. You can now add any page Elements to the header and Blog posts. Do the same for the footer.

File Under : change template

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.