Select a single 'featured' post in Tumblr? -


i tumblr homepage show single question/answer post selected 'featured' tag, or rather being recent question/answer post tagged 'featured'. don't see built in tumblr tags this.

i using jquery featured post (n number of them) category 'featured' default. have implemented solution theme - purely

here screen-shot (displaying 3 featured posts) screenshot of blog add line 's meta section

<meta name='text:featured tag' content='featured' /> 

add jquery library in

<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js"></script> 

add these lines in want display featured post

{block:indexpage}  {block:iffeaturedtag}    <h1 class="featured-subhead">      featured posts <a href="/tagged/{text:featured tag}"> + </a>    </h1>  {/block:iffeaturedtag} {/block:indexpage} 

add these lines before closing tag

{block:indexpage}{block:iffeaturedtag} <script>     var rssurl = '/tagged/{text:featured tag}/rss';     $.get(rssurl, function(data) {     $('.featured-subhead').append('<div class="featured-posts">');     var $xml = $(data);     var vari = 0;     $xml.find("item").each(function() {         var $this = $(this),             item = {                 title: $this.find("title").text(),                 link: $this.find("link").text(),                 description: $this.find("description").text(),                 pubdate: $this.find("pubdate").text(),                 author: $this.find("author").text()         }         vari = vari +1;         if(vari <4){         $('.featured-subhead').append('<div class="featured-post" style="overflow:hidden;"><h2 class="featured-title"><a href="' + item.link + '">' + item.title + '</a></h2><div class="featured-post-description' + vari + '">' + item.description + '</div><div class="featured-post-link"><a href="' + item.link + '">read more</a></div></div>');         //do item here...         }     });     $('.featured-subhead').append('</div>'); }); {/block:indexpage}{/block:iffeaturedtag} 

you can change if(vari <4){ line according numbers of posts want display featured. example, display single post, if(vari <2){ .

i have added few css classes design output. can declared in segment in

h1.featured-subhead { /* heading of featured post */ } .featured-posts { /* outer box of featured posts */ } .featured-post { /* inner box of each featured post */ } h2.featured-title { /* heading of each featured post */ } .featured-post-description { /* description or body of each featured post */ } .featured-post-link { /* link permalink page of each featured post */ } 

here featured-subhead class necessary. must added heading of featured post. jquery add featured posts after that.

how work? no surprises here. tumblr generates tag rss page each page. using javascript, fetching specific tag page , displaying 'n' number of elements xml elements. sometimes, tumblr takes little more time (i don't know why) generate rss page of newly added tags. patient , try browse your-blog.tumblr.com/tagged/featured/rss page check generated or not.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -