In tumblr, is it possible to show only posts with a certain tag in the home page?
If so, how is it done?
I have tried many ways to do this, using tumblr php api and other, This worked for me: I am using a page outside tumblr and loading the tagged posts via curl php calls. It can be done via ajax but for SEO reasons I wanted to use php. Here is the code:
$oath = 'xxx';
$blogName = 'yyy.tumblr.com';
$tag='tagname';
$apiLink = "http://api.tumblr.com/v2/blog/$blogName/posts/?api_key=$oath&tag=$tag";
// Initializing curl
$ch = curl_init( $apiLink );
// Configuring curl options
$options = array(
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => array('Content-type: application/json') ,
);
// Setting curl options
curl_setopt_array( $ch, $options );
// Getting results
$result = curl_exec($ch); // Getting JSON result string
$data = json_decode($result);
$posts = $data->response->posts;
I just wrote up the solution to the opposite problem here:
You can take inspiration from there and implement the opposite. Alternatively, you can simply add a "hidden" tag to each one of the things that you don't want displayed on the homepage.