WordPress.org

Support

Support » Plugins and Hacks » [Resolved] Custom shortcode for a tag throws an error

[Resolved] Custom shortcode for a tag throws an error

  • I’m trying to create a custom shortcode to produce XHTML break tags.

    The code below is everything in my functions.php file and previously did not give me any errors, after adding the parts to setup the shortcode, I received this error message after trying to save a WP Page with the [break] shortcode added.

    Screenshot for the error I received.

    <?php
    if ( function_exists('register_sidebar') )
    	register_sidebar(array(
    	'name' => 'sidebar',
    	'before_widget' => '<div class="sidebar-box">',
    	'after_widget' => '</div>',
    	'before_title' => '<h2>',
    	'after_title' => '</h2>',
    ));
    
    if ( function_exists('register_sidebar') )
       register_sidebar(array(
        'name'=>'blog widgets',
    	'before_widget' => '<div class="sidebar-box">',
    	'after_widget' => '</div>',
    	'before_title' => '<h2>',
    	'after_title' => '</h2>',
       ));
    
    // Function and shortcode to allow line breaks past the WordPress editor.
    
    function linebreak() {
      return '<br />';
    }
    
    add_shortcode('break', 'linebreak');
    
    ?>
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Resolved] Custom shortcode for a tag throws an error’ is closed to new replies.
Skip to toolbar