January 18, 2017
WordPress is an amazing tool. It already provides a lot of tools for blogging. It is not only for blogging it can be anything that you want to mold it into, in any structure. And for extending its powers we have many plugins as well as the themes of our tastes and a developer’s back who is happy to help us in making our own custom themes and plugins. WordPress has a good and reliable documentation as well.
Within last month I came through lots of plugins for extending the functionalities of the website, i.e. Contact Form-7, CF7-DB, Advance Custom Fields etc. All of them are pretty damn good at the functionalities they provide. But the one I liked the most is the Advance Custom Fields. This Plugin is damn good at extending the WP functionalities. Nishanth “KD” told me to experiment with that plugin for a project to make a website highly dynamic in nature. As the plugin name says a lot, this plugin can create custom fields in an advanced way.
First talking about an inbuilt functionality of the WordPress that is “Custom Fields” you can create extra custom fields for any post/page that will be stored in the database in that post meta. But it will not be shown in the frontend of the website. You have to make your theme to support it. So for adding it to the front end i’ve created a shortcode in the theme. There can be many other ways to use it, but I’ve used that way, if you have figured any other ways also please do share ;). My code below is how I did it.
This code will create a shortcode for custom fields. So that you can get the values for the particular field. Custom fields Metabox is hidden by default, you can toggle its visibility from the “Screen Options” in the top of “New Post” interface.
For using the New Field’s i have to add the shortcode [<strong>new_field</strong> <em>name="my_gist"</em>]
as the name of the field you can see is “my_gist” (its case sensitive). But as you can think, we can add the value at the place of shortcode instead. That’s why I did not find it useful, it can be useful if you want to add any data and you don’t want it to be mixed with the content so that you can manage it in the custom fields like any iframe code or maybe the gist like I have added in this post. But yeah, this functionality is limited to simple content. But if you want to make your website more dynamic than you have to try “Advance Custom Fields” Plugin.