J. Doe
J. Doe

Reputation: 525

My first WP plugin; how to transform a word in the text editor to PHP?

I'm looking for some proper documentation on how to change a [tag] to ?php in the WordPress editor;


So when the user types [maintenance-date] in their editor, it converts to $maintenance_options['disable'] which outputs the date of when maintenance is finished.

How can I do that?

Upvotes: 0

Views: 48

Answers (1)

Jeremy
Jeremy

Reputation: 249

You can just create a shortcode in your plugins file, or in your functions.php file

add_shortcode('maintenance-date', 'maintenance_date');
function maintenance_date() {
    return $maintenance_options['disable']
}

Upvotes: 1

Related Questions