How To Add Aside Post Format In WordPress?
October 14th, 2016 | by Ravi Chahar || Leave a comment |
There are different kinds of post formats and you can enable the theme support option for all including “aside“. But do you know how to add custom aside post format in WordPress theme?
Just like the “Gallery” post format, you can handle the output of the aside post using a separate file. Though the layout of an aside post would vary from one theme to another but still, in most of the cases, it doesn’t contain the title or the post published date.
If you have a little bit of knowledge about WordPress functions to show the title and the content of the post then you can handle the output for an aside post format.
An aside post format in WordPress theme would provide an option to its users to publish a unique post than the standard one.
Create A New File And Add Aside Post Format In WordPress.
There are many files in the WordPress theme file structure and you can add one more. Just open the theme folder and add a file and name it “content-aside.php“.
Whatever you add in this file, it would decide the output of the aside post. You can display your whole content or just an excerpt with the thumbnail.
Though an aside post is used just for a short update. If you go somewhere and don’t have the time to handle your blog then you can let your readers know about the date.
If you’re organizing any giveaway, let your readers know with an aside post.
Let me show an example of the code.
<p class=”meta”>by <?php the_author(); ?> <?php the_time(‘F j,Y’) ?></p>
<?php the_content(); ?>
</article>
Add this code in the newly created file and whenever you choose an aside post format for your post, a different post will get published on your blog.
Though it’s just the base. If you want to give it a new look then use the CSS language and design the aside posts.
You can add the different background color from your standard post so that it can be highlighted. The font-size can be changed.
There is no thumbnail added. If you want, just add featured image with the caption and choose its position different from your normal posts.
To design it, just use the class given above in the article section. Target the HTML elements with the class and you would get a unique aside post format.
I hope Now You can Add Aside Post Format In WordPress?
Every developer has his/her own way of coding and styling. You can alter the output of this post format according to the layout and design of your WordPress theme.
If you want to add aside post format in WordPress theme then make sure that the file you create is the key to the output.
There are many designing aspects you can try with an aside post. If you face any problem, feel free to clear your doubts.