15 Februari 2012

Letakkan tajuk pos pada link baru dan lama

Tiada ulasan:
 

Di wordpress,ada satu fungsi dimana,pada link new pos dan old pos ada disertakan dengan tajuk pos,jika korang berminat utk buat yg sama,ikut langkah yang mudah ini

Login ke blogger dashboard-->Klik Design-->Edit HTML

Cari kod </head>

Pastekan kod dibawah ini diatas kod tadi

<script src='http://code.jquery.com/jquery-latest.js' type='text/javascript'/>

Seterusnya cari kod </body>

Pastekan kod dibawah diatas kod tersebut

&lt;!--Start post title code--&gt;
&lt;b:if cond=&#039;data:blog.pageType == &amp;quot;item&amp;quot;&#039;&gt;
&lt;script type=&#039;text/javascript&#039;&gt;
// Post titles to Older Post and Newer Post links (without stats skew)
// by MS-potilas 2012. See http://yabtb.blogspot.com/2012/01/add-post-titles-to-older-and-newer-post.html
//&lt;![CDATA[
var urlToNavTitle = {};
function getTitlesForNav(json) {
for(var i=0 ; i &lt; json.feed.entry.length ; i++) {
var entry = json.feed.entry[i];
var href = &quot;&quot;;
for (var k=0; k&lt;entry.link.length; k++) {
if (entry.link[k].rel == &#039;alternate&#039;) {
href = entry.link[k].href;
break;
}
}
if(href!=&quot;&quot;) urlToNavTitle[href]=entry.title.$t;
}
}
document.write(&#039;&lt;script type=&quot;text/javascript&quot; src=&quot;http://&#039;+window.location.hostname+&#039;/feeds/posts/summary?redirect=false&amp;max-results=500&amp;alt=json-in-script&amp;callback=getTitlesForNav&quot;&gt;&lt;/&#039;+&#039;script&gt;&#039;);
function urlToPseudoTitle(href) {
var title=href.match(/\/([^\/_]+)(_.*)?\.html/);
if(title) {
title=title[1].replace(/-/g,&quot; &quot;);
title=title[0].toUpperCase() + title.slice(1);
if(title.length &gt; 28) title=title.replace(/ [^ ]+$/, &quot;...&quot;)
}
return title;
}
$(window).load(function() {
window.setTimeout(function() {
var href = $(&quot;a.blog-pager-newer-link&quot;).attr(&quot;href&quot;);
if(href) {
var title=urlToNavTitle[href];
if(!title) title=urlToPseudoTitle(href);
if(title) $(&quot;a.blog-pager-newer-link&quot;).html(&quot;&amp;lt;&amp;lt; Newer Post&lt;br /&gt;&quot; + title);
}
href = $(&quot;a.blog-pager-older-link&quot;).attr(&quot;href&quot;);
if(href) {
var title=urlToNavTitle[href];
if(!title) title=urlToPseudoTitle(href);
if(title) $(&quot;a.blog-pager-older-link&quot;).html(&quot;Older Post &amp;gt;&amp;gt;&lt;br /&gt;&quot; + title);
}
}, 500);
});
//]]&gt;
&lt;/script&gt;
&lt;/b:if&gt;&lt;!--End post title code--&gt;

Akhir sekali,cari kod ]]></b:skin>
Pastekan kod dibawah di atas kod tadi

.blog-pager-newer-link {background-color:transparent !important;padding: 0 !important;}
.blog-pager-older-link {background-color:transparent !important;padding: 0 !important;}
#blog-pager-newer-link {padding:5px;font-size:90%;width:200px;text-align:left;}
#blog-pager-older-link {padding:5px;font-size:90%;width:200px;text-align:right;}

Save template dan lihat hasilnya^^

Tiada ulasan:

Catat Ulasan

TERIMA KASIH UNTUK KOMENKOMEN TERBARU

 
© 1986. Aideal Fitri - fitri1986 Malaysian Blogger