Q1. How will you disable theme and plugin editing in your WordPress admin?
Ans. Adding the following constant will disable theme and plugin editing from within the WordPress admin:
|| define(‘DISALLOW_FILE_EDIT’, true);
Q2. How will you prevent automatic update to a plugin which you have modified?
Ans. You can do it by changing the name of the plugin’s directory then activating it again into your WordPress dashboard. Alternatively, you can modify the name of the plugin to achieve the same.
Shortcode API is introduced in WordPress 2.5, it is a simple set of functions for creating macro codes for use in post content. For instance, the following shortcode (in the post/page content) would add a photo gallery or a form or anything into the page:
It enables plugin developers to create special kinds of content (e.g. forms, content generators) that users can attach to certain pages by adding the corresponding shortcode into the page text.
The Shortcode API makes it easy to create shortcodes that support attributes like this:
[shortcode id="123" size="medium"]
The API handles all the tricky parsing, eliminating the need for writing a custom regular expression for each shortcode. Helper functions are included for setting and fetching default attributes. The API supports both self-closing and enclosing shortcodes.
But what should we do when we have to call the shortcode direct into the files of our template/theme ?
<?php echo do_shortcode('[shortcode]'); ?>
and if we want to add attributes to the shortcode then, write
<?php echo do_shortcode('[shortcode option1="value1" option2="value2"]'); ?>