Users can make shortcodes with the use of WordPress Shortcode API, as it enables users to take benefits of existing theme features from any test-based area on WordPress site.

The shortcode functions can be created in three simpler steps-

1. Create function in function.php and register
function display_related_posts($array = array()) {
   <div class="col-md-12 remove-padding m-t20">Shortcode function defination</div>
}
add_shortcode('display_related_posts', 'display_related_posts');


2. Now you can call anywhere in file or editor with this function.
do_shortcode('[display_related_posts]');

BY Best Interview Question ON 08 Oct 2019