Select one Tumblr favorite post?

I would like my Tumblr homepage to show a single question / question that is selected by the 'featured' tag, or rather, being the last Question / Answer tag with the 'featured' tags. I don't see any Tumblr built-in tags that will do this.

+4
source share
3 answers

I use jQuery to get a recognized entry (n number of them) from the default 'featured' category. I applied this solution to my theme - Purely

Here is a screenshot (showing three recognized posts) Screenshot of my blog Add this meta section of the line

<meta name='text:Featured Tag' content='featured' /> 

Add jQuery library to

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

Add these lines to where you want the published post to appear.

 {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 immediately before the 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 something with item here... } }); $('.featured-subhead').append('</div>'); }); {/block:IndexPage}{/block:IfFeaturedTag} 

You can change if (vari <4) {line according to the message numbers you want to display as shown. For example, to display a single record, this would be if (vari <2) {.

I also added some CSS classes to develop the output. This can be declared in a segment in

 h1.featured-subhead { /* Heading of featured post */ } .featured-posts { /* Outer box of all 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 to Permalink page of each featured post */ } 

Only the featured-subhead class is needed here. This must be added to the title of the note. After that, jQuery will add recommended posts.

How it works? There are no surprises here. Tumblr creates an RSS tag page for each page. Using javascript, I retrieve this page with specific tags and output the "n" number of elements from the XML elements. Sometimes Tumblr takes a little longer (I don't know why) to create an RSS page for newly added tags. Be patient and try looking at your-blog.tumblr.com/tagged/featured/rss page to make sure it is generated or not.

+3
source

What you are requesting is not a native parameter for tumblr, in other words, there is no preference setting that you can just check.

To do what you described above, you will need to either edit the current theme code or create a new theme from scratch.

To show only 1 question at the top, with a tag tag, you will need to work with jQuery / Javascript and the Tumblr API.

It's pretty complicated coding, but if you think about it, go to the Tumblr Codex API .

+1
source

It's a bit late, but in case it helps: Our free Single A theme has a built-in sticky mail feature. This is the first (and only) tumblr theme to use it. You can get it here: http://www.tumblr.com/theme/28638 or learn more about it here: http://singleatheme.tumblr.com/ . Hope this helps!

0
source

All Articles