Shopify: How to show WordPress style featured images for your blog landing page

Shopify: How to show WordPress style featured images for your blog landing page

Posted by on Feb 26, 2014 in Shopify | 0 comments

Shopify has a very limited blog functionality. Unfortunately a lot of people have gotten used to the goodness of WordPress and expect some of the same features. One thing that is definitely missing is the ability to set featured images for your blog posts, especially if you’d like to have a nice blog landing page.

The work around is to upload specifically named images into the your assets folder that are identified by the blog post id. So if the url of your post is http://www.myshopifysite.com/blogs/magazine/12256445-the-title-of-article then the blog post id is 12256445. So you would upload an image called blog-12256445.jpg to your assets folder.

On the blog index page you can display the images within the for article loop with the following code:

Essentially we construct the variable file_name to use the post id in the name, we also construct alt_attr to use in the alt tag and populate that with article.title and then call the asset_url filter to display our image.

Post a Reply

Your email address will not be published. Required fields are marked *