Note that there are some explanatory texts on larger screens.

plurals
  1. POFeatured post in tumblr based on multiple tags
    primarykey
    data
    text
    <p>I'm trying to display a specific tumblr post, based on tags. </p> <p>Struggling with: 1. how to query tumblr for multiple tags? -- (a similar post here: <a href="https://stackoverflow.com/questions/6043119/how-to-query-multiple-tags-in-tumblrs-read-api">How to query multiple tags in Tumblr&#39;s read api?</a>) -- but how would I adapt it to my script? 2. assigning a class to the rendered post, based on its tag. For instance, if the post is tagged "featured_1", it should display a class of "featured_1", in the rendered html. </p> <p>Many thanks in advance! Any help appreciated.</p> <p>here is the script I'm working with: </p> <pre><code>/* -------------------------------------- Created by james &lt;at&gt; bandit.co.nz http://blog.bandit.co.nz */ Featured = { 'apiNum' : 100, // how many posts to read 'listId' : 'featured', // the id of the ul to write to 'tagName' : 'featured', // the name of the tag we're searching for 'tagName2': 'featured_1', 'tagName3': 'featured_2', 'tagName4': 'featured_3', 'postDB' : [], 'listPos' : 0, 'doList' : function (where) { var li; var ul = $('#'+where); var titles = {"link":"link-text", "photo":"photo-caption", "quote":"quote-text", "regular":"regular-body", "video":"video-caption"} // cycle through post database pcount = Featured.postDB.length; for(i=Featured.listPos;i&lt;pcount;i++) { p = Featured.postDB[i]; if(p[titles[p.type]] != '') titlestr = p[titles[p.type]].replace(/&lt;\/?[^&gt;]+&gt;/gi, ''); else titlestr = p['url']; li = document.createElement('li'); $(li).html('&lt;p class=" "&gt;'+titlestr+'&lt;/p&gt;'); ul.append(li); Featured.listPos = pcount; } }, 'getData' : function() { $.get('/api/read/json?num='+Featured.apiNum+'&amp;tagged='+Featured.tagName3+Featured.tagName+Featured.tagName2, function(data) { eval(data); for(i=0;i&lt;tumblr_api_read.posts.length;i++) { Featured.postDB.push(tumblr_api_read.posts[i]); Featured.doList(Featured.listId); } } ); } }; $(document).ready(function(){ Featured.getData(); }); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload