How to setup a Textpattern playlist
There was once a time when my most-asked-question was “can you send me the Firefox logo vector originals please”. Nowadays, it’s “How did you do the playlist bit – is it a plugin?”. So to save repeating myself, I’m writing this up as a blog post.
First of all, I’m afraid it isn’t a plugin. While there are ways of using the Amazon API to pull out album cover images automatically, I’ve had mixed results. Sometimes its wrong, and sometimes it doesn’t stock the album., which as an anal cover fetishist, just isn’t acceptable.
So, before I go further, bear in mind that with Textpattern, you can add anything, and send to anywhere, and display it how you like it. While not completely automated, my system does at least allow me to update the playlist fairly quickly.
Here are the steps if you want to try to setting one up yourself:
- Create a new custom field called “Amazon URL”. This is used to store the link (My own setup is slightly different as it uses the ASIN instead)
- Create a new section called ‘Playlist’. Turn all the radio button options to ‘no’. This will give us a specific section to post to.
- Create an ‘article’ form called ‘covers’, and add the following:
<li><a href="<txp:custom_field name="Amazon URL" />" title="<txp:title />"> <txp:article_image /> </a></li>
- In your page template, where you want the playlist to appear, add the following:
<ul> <txp:article_custom form="covers" limit="9" section="playlist" sortby="Posted" sortdir="desc" /> </ul>
The article_custom tag is the key here. It isn’t context-sensitive like
<txp:article />and allows you to output content from a different section anywhere you like.
Then I add the content. So being the aforementioned anal cover fetishist, I upload these manually via Content > Images. I then take a mental note of the image ID, go to the write tab, and enter this number in the ‘article image’ field.
Then all that needs to be done is add the Title, and choose the correct section. Done!