Skip to content

Instantly share code, notes, and snippets.

@alenabdula
Created December 11, 2015 18:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alenabdula/220bbe8d92f2a0372561 to your computer and use it in GitHub Desktop.
Save alenabdula/220bbe8d92f2a0372561 to your computer and use it in GitHub Desktop.
Sets proper headers for RSS Feeds using Timber Library and Twig Templating Engine
<?php
/**
* Sets proper headers for RSS Feeds using Timber Library and Twig Templating Engine
* Fallbacks:
* 1. application/rss+xml,
* 2. application/rdf+xml,
* 3. application/atom+xml,
* 4. application/xml,
* 5. text/xml
*/
header("Content-Type: application/rss+xml, application/rdf+xml, application/atom+xml, application/xml, text/xml");
# Timber Context
$context = Timber::get_context();
# Render View
Timber::render('feeds.twig', $context);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment