What do I use when I need to create easy-to use and lightweight functionality to let business owners add additional information about some issue in WordPress admin panel?
The answer is – AСF plugin (Advanced Custom fields).
- Install and activate plugin
- Go to “Custom Fields” in menu bar in Admin panel of WordPress
- Press “Add new” and name new group.
- Choose conditions (in what types of pages, posts custom fields will be displayed). For example, if you need to display location input only in tours category posts and don’t want them show in food category posts, set the following condition “Post Category” is equal to “Tours”.
- Go to one of the posts in choosen category and edit it. You will see input fields in the bottom.
- Fill them.
- Go to FTP (wp-content –> themes –> theme name –> single.php
- After get_template_part( ‘entry’ ) insert the following code:
<?php echo get_field(‘location’); ?>
It will display the content that you write down in input field named “location” in posts in category “Tours”