Home » Blog » Cybersecurity » Cybersecurity » How To Create A Shortcode For A Blank Or Empty Line On WordPress

How To Create A Shortcode For A Blank Or Empty Line On WordPress

[Normal_Box]Creating blank and empty lines on WordPress

Creating Empty Lines On WP

There may be a point in time where someone needs to create an empty space or a blank line somewhere on WordPress, without using CSS markups. For instance, sometimes the visual editor on WordPress can become clustered, and [shortcode] can be used to identify or mark the location of a blank line.

There are plenty of right ways to create blank spaces and empty lines on WordPress including the use of amperstamps (&nbsp;), rule tags (<br>,<hr>), creating tables, columns, and more. What we did in the code snippet below is we used an amperstamp with paragraph tags to be used as a PHP function, so when the shortcode [blank] is inserted onto a page or post on WordPress an individual blank line or empty space is created.[/Normal_Box]

Copy and paste into functions.php file Copy and paste the snippet below into your current theme’s functions.php file.[Normal_Box]

/* shortcode for blank line */
function blankline() {
 return '<p>&nbsp;</p>';
add_shortcode('blank', 'blankline');

[/Normal_Box]To create a blank or empty line on WordPress use the shortcode: [blank]

Sean Doyle

Sean is a tech author and engineer with over 20 years of experience in cybersecurity, privacy, malware, Google Analytics, online marketing, and other topics. He is featured in several publications.

More Reading

Post navigation


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

The best bbPress shortcodes for WordPress

The Easiest Way To Add Favicons To WordPress Websites

How To Start A WordPress Newsletter