I am far from a WordPress expert, as this post will highlight. However, I am a hobbyist and an out of practice one at that. This past week I’ve been messing around with the template here on the site.
In doing so, I ran into a problem and it took me a while to google properly and figure out the issue.
The issue was that I use custom post formats for various things on the site. I have a format for the movie/book/tv reviews, a format for links, the format for normal posts, etc. But I was really struggling to figure out how to get WordPress to change display information for the different things.
The core of my problem was I kept trying to use get_post_type(). Like the definition of insanity, I tried it over and over expecting something to change somewhere.
I did this because in my mind these are different post types. To avoid confusion, I’ve properly referred to them above as formats but in my mind those are different types of posts. However, every time I would try to use get_post_type(), it always only returned ‘post,’ regardless of if I had set it as ‘link’ or something else. So I kept banging my head on my metaphorical desk.
Well, it took until Sunday morning (watching Manchester City vs. Sheffield United) for me to properly Google fu my way to an answer. WordPress parlance is that the above are post formats and not types, and the correct command is get_post_format() (reference link.)
I wanted to share about this here because the first several answers when Googling don’t highlight this difference well enough or at all. If I lost hours trying to solve this issue, then I’m sure there are others doing the same thing and hopefully I can save someone else a few hours of their time.