Search code examples
javascriptapitumblr

Setting up a sticky post tag in tumblr?


Does anyone have any clues about how one might go about setting up a sticky post function using a special tag in tumblr? I know that the Single A theme has this functionality but there's no documentation and I'm trying to avoid decoding it all. Has anyone done this?


Solution

  • You would choose to use a specific tag for the post, say, 'sticky' and then run an API call only on posts tagged with Sticky, limiting to 1 (optional).

    http://api.tumblr.com/v2/blog/[YOURBLOG].tumblr.com/posts/?api_key=[YOURAPIKEY]&limit=1&tag=sticky
    

    More info on the API can be found here: http://www.tumblr.com/docs/en/api/v2#posts

    The API call would look something like this in JS:

    $.ajax({
        url: '[URL_FROM_ABOVE]&jsonp=?',
        dataType: 'jsonp',
        type: 'get',
        success: function(data){
    
            // do something with your data
    
        }
    
    });