Thủ Thuật Thesis: Thêm Menu Đẹp Dưới Mỗi Bài Viết

by Tran Tinh · 25 comments

godaddy300x250 new 20100704042729 Thủ Thuật Thesis: Thêm Menu Đẹp Dưới Mỗi Bài Viết

Hôm nay, blogviet xin chia sẻ một thử thuật của George – một trong những blogger chuyên có các thủ thuật Thesis mà mình rất thích. Thủ thuật này khá đặc biệt và chắc chắn nhiều bạn đang sử dụng Thesis theme sẽ thích. Để cho các bạn dễ hiểu thì mình xin chia sẻ hình sau để các bạn biết thực sự thủ thuật này như thế nào, hình thù của nó ra sao:

Image credit: serradinho.com

Image credit: serradinho.com

Như vậy các bạn biết điều mà mình muốn chia sẻ là gì rồi đúng không? Xin đi ngay vào thủ thuật này.

Vì thủ thuật này tác động đến teaser post nên để nó hiện tốt thì bạn cần vào trong Thesis Options và chọn Home Page Display, bạn chọn số bài viết hiển thị là 0. Sau đó, bạn vào Design Options, vào mục Teaser, sau đó chọn Teaser Display Options, bạn sẽ thấy nút “link to full article” đã được chọn. Các bạn không chọn rồi lưu lại.

Bây giờ bạn chèn đoạn code sau vào file custom.css:

.custom .teaser {width: 100%; margin-top: 0.25em; padding-top: 0.25em; text-align: justify;}
.custom .teasers_box {padding-top: 0; padding-bottom:0; border-top: 0;}
.custom #teaserlinkscontainer {margin-top:0px;}
.custom #teasermenu {height: 30px;}
.custom #teasermenu , .teasermenu ul {padding: 0; margin: 0; list-style: none; line-height: 1; border-width: 0.5em 0.5em 0.5em 0.5em;}
.custom #teasermenu ul {float: left; list-style: none; margin: 0px 0px 0px 0px; padding: 0px;}
.custom #teasermenu li {float: left; list-style: none; margin: 0px; padding: 0px;}
.custom #teasermenu ul li {list-style: none; margin: 0px; padding: 0px;}
.custom #teasermenu a, .custom #teasermenu li ul {border-color: #FFFFFF;}
.custom #teasermenu li a, .custom #teasermenu  li a:link {color: #FFFFFF; background: #444343; display: block; font-weight: bold; margin: 5px 5px 5px 5px; padding: 5px 5px 5px 5px; text-decoration: none;  font-size: 13px; font-family: Arial, Helvetica, sans-serif; -moz-border-radius-bottomleft:4px; -moz-border-radius-bottomright:4px; -moz-border-radius-topleft:4px; -moz-border-radius-topright:4px; -webkit-border-top-left-radius:4px; -webkit-border-top-right-radius:4px; -webkit-border-bottom-left-radius:4px; -webkit-border-bottom-right-radius:4px;}
.custom #teasermenu li a:hover, {color: #FFFFFF; background: #7BAAD9; display: block; margin: 5px 5px 5px 5px; padding: 5px 5px 5px 5px; text-decoration: none; -moz-border-radius-bottomleft:4px; -moz-border-radius-bottomright:4px; -moz-border-radius-topleft:4px; -moz-border-radius-topright:4px; -webkit-border-top-left-radius:4px; -webkit-border-top-right-radius:4px; -webkit-border-bottom-left-radius:4px; -webkit-border-bottom-right-radius:4px;}
.custom #teaserempty {width: 100%; margin-top: 0.5em; margin-bottom: 0.5em;}
.custom #teaserline {width: 100%; margin-top: 0.5em; margin-bottom: 0.5em; border-top: 1px solid #D0D0D0;}
.custom #teasermenu li p,{color: #000000; background: #D0D0D0; display: block; width: 100%}

Tiếp đó bạn chèn 2 đoạn code sau vào file custom_functions.php:

Code 1: Code này giúp thay đổi độ dài đoạn tóm tắt sẽ hiển thị trên trang chủ (75), bạn có thể tăng hoặc giảm theo ý muốn:

add_filter('excerpt_length', 'my_excerpt_length');
add_filter('the_excerpt', 'no_ellipsis');

function my_excerpt_length($length) { return 75; }
function no_ellipsis($text) { return str_replace('[...]', '.....', $text); }

Code 2: Code này giúp các bạn thêm các nút như hình minh họa ở trên:

add_action('thesis_hook_after_teaser','teaser_post_menu_links');

function teaser_post_menu_links() {
if (!is_single() && !is_page()){ ?>
<div id="">
<div id="teaserempty"></div>
<div id="teaserlinkscontainer">
    <ul id="teasermenu">
    &lt;li&gt;&lt;a href=&quot;&lt;?php the_permalink(); ?&gt;#comments&quot; title=&quot;&lt;?php comments_number(__('0 Góp ý','<a href="http://eblogviet.com/tag/thesis-floating" style="color:#0000FF;text-decoration:underline;" target="_blank" rel="nofollow" onmouseover="self.status='http://eblogviet.com/tag/thesis-floating';return true;" onmouseout="self.status=''">thesis</a>'), __('1 Góp ý','<a href="http://eblogviet.com/tag/thesis-tips/feed" style="color:#0000FF;text-decoration:underline;" target="_blank" rel="nofollow" onmouseover="self.status='http://eblogviet.com/tag/thesis-tips/feed';return true;" onmouseout="self.status=''">thesis</a>'), __('% Góp ý','<a href="http://eblogviet.com/tag/thesis-author" style="color:#0000FF;text-decoration:underline;" target="_blank" rel="nofollow" onmouseover="self.status='http://eblogviet.com/tag/thesis-author';return true;" onmouseout="self.status=''">thesis</a>')); ?&gt; on &lt;?php the_title(); ?&gt;&quot; rel=&quot;nofollow&quot;&gt;&lt;?php comments_number(__('0 Góp ý','<a href="http://eblogviet.com/tag/thesis-floating"" style="color:#0000FF;text-decoration:underline;" target="_blank" rel="nofollow" onmouseover="self.status='http://eblogviet.com/tag/thesis-floating"';return true;" onmouseout="self.status=''">thesis</a>'), __('1 Comment','<a href="http://eblogviet.com/tag/thesis-tutorial"" style="color:#0000FF;text-decoration:underline;" target="_blank" rel="nofollow" onmouseover="self.status='http://eblogviet.com/tag/thesis-tutorial"';return true;" onmouseout="self.status=''">thesis</a>'), __('% Góp ý','<a href="http://eblogviet.com/tag/thesis" style="color:#0000FF;text-decoration:underline;" target="_blank" rel="nofollow" onmouseover="self.status='http://eblogviet.com/tag/thesis';return true;" onmouseout="self.status=''">thesis</a>')); ?&gt;&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href=&quot;&lt;?php the_permalink(); ?&gt;#respond&quot; title=&quot;Add your opinion on &lt;?php the_title(); ?&gt;&quot; rel=&quot;nofollow&quot;&gt;Đăng góp ý của bạn&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href=&quot;&lt;?php the_permalink(); ?&gt;&quot; title=&quot;Đọc tiếp: &lt;?php the_title(); ?&gt;&quot; rel=&quot;bookmark&quot;&gt;Continue Reading&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;p&gt;&lt;/p&gt;&lt;/li&gt;
    &lt;/ul&gt;
&lt;/div&gt;
&lt;div id=&quot;teaserline&quot;&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;?php } }

Hy vọng thủ thuật này sẽ giúp cho các bạn ít nhiều. Chúc thành công!

Viết bởi Tran Tinh

Blog Kiếm Tiền là trang blog cá nhân chuyên viết về các chương trình kiếm tiền trên mạng, thủ thuật blog, thủ thuật SEO, CNTT, Web 2.0, affiliate marketing & Social Media...có ích cho các blogger Việt Nam.

1 Naruto_thf90 December 17, 2009 at 5:19 pm

Em thấy cái này bên anh Minh Mèo :D Khi nào có Thesis em làm ngay ;))
.-= Naruto_thf90´s last blog ..Theme Giáng Sinh dành cho Windows 7 =-.

Reply

2 Minh Mèo December 17, 2009 at 8:49 pm

Anh đang nghĩ cách xử lí, để nguyên như này làm trang index load rất lâu
.-= Minh Mèo´s last blog ..Bằng chứng nhận séc (check) của Adbrite =-.

Reply

3 Ken Design December 17, 2009 at 10:35 pm

Với lại hình như blog bạn background để fixed, nên khi quá nhiều images, chẳng hạn như ads, khi kéo thanh trượt Ken thấy hơi dựt! Mình duyệt trên FF!
.-= Ken Design´s last blog ..89 Typadelic Fonts Collection =-.

Reply

4 Tran Tinh December 21, 2009 at 7:09 pm

Cái này thì mình cũng cảm thấy, vì thế mà mình hạn chế tối đa các thủ thuật để cho nó lành!

Reply

5 ngocthachez December 17, 2009 at 6:00 pm

Đúng là để sử dụng tốt Thesis cần phải có cái đầu và am hiểu CSS :shutup:
.-= ngocthachez´s last blog ..Google Blogger ( Blogspot ) tích hợp Amazon Associates =-.

Reply

6 Tran Tinh December 21, 2009 at 7:10 pm

Cái này thì không phải Thesis mà bất kỳ theme nào cũng cần em ah :smile:

Reply

7 TipsViet December 17, 2009 at 8:26 pm

Tớ làm nhưng bị lỗi… Sau khi làm xong thì các Gravatar nằm bên cạnh title biến mất… và các ảnh chèn nằm trong teaser đều bị crop về kích thước 66×66. và bị số lỗi khác nữa…. :$$$: Link ảnh:
http://www.tipsviet.com/wp-content/uploads/thesis.JPG

Reply

8 Tran Tinh December 21, 2009 at 7:12 pm

Cái này thì mình chưa hiểu rõ ngọn ngành nhưng nếu lỗi thì cách đơn giản là không nên tham qua. Hoặc là bạn tăng excerpt từ 75 lên 100 xem sao, có thể do hình to quá nó đẩy gravatar nên gây ra lỗi đó đấy :clap:

Reply

9 Vút Bay.net December 17, 2009 at 9:25 pm

Dạo này Thesis lên ngôi quá
.-= Vút Bay.net´s last blog ..Phần mềm hỗ trợ mạch JDM Extreme =-.

Reply

10 Tran Tinh December 18, 2009 at 10:48 am

Dạo này là ở VN thôi, nó lên ngôi vương trên thế giới lâu rồi, em đang đợi V2.0 của nó ra đời xem sao :clap:

Reply

11 Mr.Bot December 19, 2009 at 12:43 am

em cũng đang mong bản 2.0 đây [-(
.-= Mr.Bot´s last blog ..Poker King [2009][DVDRip-XviD-GAYGAY] =-.

Reply

12 anh3ngơ December 17, 2009 at 9:37 pm

Thank Tỉnh
.-= anh3ngơ´s last blog ..Vi Cầm xinh đẹp hơn sau khi kết hôn =-.

Reply

13 Ken Design December 17, 2009 at 10:31 pm

Cái này dùng cho page magazine khá hay! Thanks anh Tĩnh!
.-= Ken Design´s last blog ..89 Typadelic Fonts Collection =-.

Reply

14 Tran Tinh December 18, 2009 at 10:47 am

Hy vọng nó giúp được bạn ít nhiều :vic:

Reply

15 anh3ngơ December 18, 2009 at 8:09 am

Hôm nào Tỉnh chỉ cho vài đường cơ bản để tạo được cái hộp seârch đẹp như của Tỉnh nhé
.-= anh3ngơ´s last blog ..Sắm Laptop xịn để đọc truyện tranh +18 =-.

Reply

16 Minh Mèo December 18, 2009 at 10:00 am

Anh Tỉnh dùng Google Custom Search, Minh có 1 bài hướng dẫn cài và custom cho đẹp với blog, bạn có thể đọc ở đây :)
http://minhmeo.info/wordpress/huong-dan-cai-dat-google-custom-search-vao-wordpress.html
.-= Minh Mèo´s last blog ..Hướng dẫn add Google Translator vào blog =-.

Reply

17 Tran Tinh December 18, 2009 at 10:27 am

Bài của Minh cũng hay nhưng khi Google thêm template mới thì chỉ cần 1 click là có ngay tại google.com/webelements hoặc xem thêm tại đây: http://blogviet.info/thuthuat/google-web-elements-vua-tim-vua-kiem-tien.html

Chúc bác thành công :clap:

Reply

18 xem tivi online nhanh nhất việt nam December 18, 2009 at 3:11 pm

cái này hay quá, không biết có dùng được cho blogspot không nhỉ ?
.-= xem tivi online nhanh nhất việt nam´s last blog ..Kênh ITV =-.

Reply

19 Minh Mèo December 18, 2009 at 3:41 pm

Chỉ có Wordpress dùng theme Thesis thôi bạn :)
.-= Minh Mèo´s last blog ..Name.com giảm giá domain mừng Giáng Sinh =-.

Reply

20 Tran Tinh December 21, 2009 at 7:14 pm

Bạn @Minh đã trả lời rồi bạn ah

Reply

21 PLnet December 19, 2009 at 10:35 pm

làng nhàng quá

Reply

22 Tran Tinh December 21, 2009 at 7:14 pm

Bạn không dùng Thesis thì quan tâm làm gì, thủ thuật chỉ dành cho thesis thôi mà :smile:

Reply

23 PLnet December 19, 2009 at 10:36 pm

ok
.-= PLnet´s last blog ..Những Bức Ảnh Của Tớ Nè =-.

Reply

24 AkuVn January 21, 2010 at 4:36 pm

Mình nghĩ nên cân nhắc khi sử dụng vì có thể sẽ làm giảm tốc độ load của web!
Ngoài ra khi can thiệp quá nhiều thì hay bị xảy ra xung đột :D

Reply

25 Thiết kế logo May 4, 2010 at 5:57 pm

Cảm ơn bác, vừa chui vô minhmeo sang đây lại có tut thế mà giwof mới đọc :2:

Reply

Leave a Comment

:smile: :2: :$$$: :stop: :angry: :what: :shutup: :an_tat: :2clap: :ekek: :knife: more »

  Tự động TELEX Tắt

Previous post:

Next post: