How to add post formats in your theme?


Jun 04 2012
blog-image
admin PHP Wordpress Wordpress Plugins 0 Comments

Today I am going to write about post formats in WordPress. First what is post format? Post format is piece of meta information that can be used by a theme to customize its presentation of a post. WordPress support 9 type of post formats:

Why post formats are important and how to add it in theme?

By using post formats you can make your theme attractive like you can use a small different icon for every different post, you can use different color for post for different post formats..there are many way to use post formats for theme to make theme attractive.

  • aside
  • gallery
  • link
  • image
  • quote
  • status
  • video
  • audio
  • chat

Now you can use/add this post format in your theme. So if you want to add post format in your theme then what you should do? Open functions.php and add below line anywhere in functions.php file :

Now go to add new posts/edit posts and you will be able to see post formats at right side.

Now you can see Standard post format also, you were thinking that you didn’t add any post format like this also I didn’t mention this type of post format before, So where it comes from? When writing or editing a Post, If you have a post which don’t require any post format then Standard is used to designate as no Post Format. Also if a format is specified that is invalid then standard (no format) will be used.

Now you added post format now you are thinking how we can get that post format for posts while showing posts on site? Ok, So here is the function to get post format for every post.

You can use this line of code to get post format. If you are using this function in while loop then no need of mention $post_id, it will automatically take $post_id if it is used in loop. If you are using outside of loop, then you must have use/pass $post_id to this function in order to achieve post format for that post.

I hope this article helps you.If you really like this article tweet about it or share it on Facebook or make comment.

Leave a Reply

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

Get News In Your Inbox

Name
Email *

Popular Blogs

recent-blog-image
How to create callback functions for jQuery plugins & extensions?

Most of the time custom jQuery plugins and extensions that we create do not use callback functions. They usually simply work on DOM elements or do some calculations. But there…

Continue Reading
recent-blog-image
Top 5 Best Ecommerce plugins in WordPress

Nowadays online shopping has increased and become very convenient shopping place for users, you may be wanting to start your own online shop so you can unleash your products to…

Continue Reading
recent-blog-image
10 Best WordPress Live Chat Plugins for Customer Support

The Live chat is the common thing now days, if you own any eCommerce website or if you are the service provider. It makes easy for your customers to contact…

Continue Reading
recent-blog-image
Free plagiarism checker sites

Plagiarism is the process of taking someone’s ideas & work and passing them off as one’s own. Prevent Plagiarism to check originality of content is the most important factor for…

Continue Reading
recent-blog-image
How to show wordpress posts in other CMS?

Currently since from few weeks, I am working on Expression Engine. Now you thought that what is Expression Engine. Now let me explain you in little brief. Expression Engine is…

Continue Reading

Remarkable Facts About Us

0 %
Client satisfaction
0 +
Years of Experience
0 +
Happy Clients
+
Projects Accomplished

Ready to Get Started ?