I’m doing up a blog at the moment where each post is accompanied by the name of a song. Adding the songs to the posts is fairly easily done via custom fields.
However, I also need to have a page which lists all the songs in one place. Can this be done without using a plugin? If so, how? (And if not, then what’s the best plugin to use to do it?)
Thanks.
I suggest using shortcode, as this’ll easily allow you embed the song list anywhere in your content, in any page or post.
UPDATE: I got a little carried away, and ended up with this!
You can use it like so;
See how using
%
indicates a meta key, which’ll get swapped out with the value at run-time.Also note that
%post_title
and%link
are two special parameters that get swapped with the post title and anchor link, respectively.You can also format the contents of the link text in the same way;
Finally, the
key
attribute controls which posts are retrieved.I’d recommend replacing the hard-coded defaults at the beginning of the function with your most often used parameters.