2009-04-05

Image

Moving elements in Post Footer - Labels, Posted by, Comment Link...

n this tutorial we're going to identify the code of each element in default Blogger XML templates (new Blogger Beta). The reason we do this:

► because we'd like to rearrange the elements in post footer (divide them, change positions)
► move one (or more) of the elements somewhere else (like: under the Post Title)


REARRANGING ELEMENTS
You can rearrange Post footer elements without tweaking the code:
DASHBOARD ► LAYOUT ► PAGE ELEMENTS click on Edit in BLOG POSTS box:

If this works for you, great!
But, lots of times, you CAN rearrange the elements by "dragging" them around, and they will seem to be rearranged, and when you go check your Blog - NOTHING has changed!
You can solve this with:

► by manually rearranging the elements in HTML code

If you're ready, let's go visit the HTML of our template....
Before making any changes to your code, I suggest to back up the current Blogger layout. Then go to:
LAYOUT ► EDIT HTML ► click on Expand Widget Templates


Use the [CTRL] + F (or (EditFind from your browser's menu) and search for this line:
Post-footer is divided in 3 lines, and each line has some elements in it(Labels, Comment Link, Posted by, Timestamp...) wrapped in a span.
...in orange, you can see how to identify the Post-footer line (in this example, 1st line)
...in pink you can see the code of Posted by, in green of Timestamp, and in blue of Comment Link

Notice how each element is wrapped in a span:





...in orange, you can see the opening span and closing span
Span class identifies the element:






























span class='post-author vcard' ► Posted By
span class='post-timestamp' ► Timestamp
span class='post-labels' ► Labels
span class='post-comment-link' ► Comment link
span class='post-backlinks ► Links to this post
span class='post-icons' ► Email this post icon and Quickedit icon
span class='reaction-buttons' ► Reactions
span class='star-ratings' ► Star ratings
span class='post-location' ► Post location


The whole idea of rearranging elements manually is a simple CUT and PASTE:
► CUT the code of the element you'd like to move
► PASTE it in the line you prefer

You need to cut the entire code of the element, meaning the whole Span. For example, if I want to move the Labels in the first line, I'll CUT the code representing Labels:
...and PASTE in somewhere under the 1st Post footer line:
...apply the same rule for other elements.


MOVE THE ELEMENT FROM POST FOOTER UNDER THE POST TITLE
Same way you rearranged the elements in Blogger post footer, you'll move them under your Post Title.For this example, I've chosen to place my Blog Labels under the Post title.

1. First thing is to CUT the code of the element we'd like to move (Labels in my example):




,


..the code you CUT needs to be wrapped in a Span (in orange) (DO NOT cut anything extra!)

2. PASTE your code into Notepad (Texedit)

3. Locate this line in your code:
...and place your Labels code UNDER this line.
You will notice that the Labels are now in place, but without the default style. The reason this happened is because we've "ripped" the Labels from Post Footer, which has a defined style.

4. We have to create a style for the Labels element, and adjust it to fit. Add the code in orange around the Labels code:


...we've just wrapped the Labels code in a "div" so we can manipulate with it better.

Next, copy this:
.under-title {
margin: 0 0 10px 0;
color:#000000;
text-transform:uppercase;
letter-spacing:0px;
font-family:arial;
font-size:10px;
}

And place in anywhere ABOVE this part:
]]>
...in pink, you can adjust the margin of the element
...change the style (color, line-height, font) to whatever suits you..


MOVING MORE ELEMENTS UNDER POST TITLE
Now, this will be much easier. You just have to CUT the the code of the element (the entire span!), and place it in the "div", like so:








..in orange, you can see the main div that defines the style for the whole container, and everything you place there, will automatically "pick up" the style...
..now, this will place everything in the same line. Hm. If this is to messy for you, you can place each element in it's own row.
All you have to do is change the word:
span into div

For example, the Labels code will look like this after the change:
<div class='post-labels'>



,

div>
..in orange, you can see we changed span into div...

That's it.

التعليقات:

Total Pageviews