• Resolved daminthi87

    (@daminthi87)


    Hi,

    I experienced that [um_loggedout] … [/um_loggedout] creates a line break after the shortcode output.
    Interestingly other shortcodes I used like for example [um_show_content not=”] do this not, which is much more preferred in my case.

    Any help would be welcome!

    Thank you!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @daminthi87

    The shortcode [um_loggedout] adds a <p> tag automatically. You can try using this [um_loggedout_v2] shortcode without the <p> tag. Just add the following code snippet to your theme/child-theme’s functions.php file or use the Code Snippet plugin to run the code.

    add_shortcode( 'um_loggedout_v2', array( &$this, 'um_loggedout_v2' ) );
    function um_loggedout_v2( $args = array(), $content = '' ) {
    			ob_start();
    
    			// Hide for logged in users
    			if ( is_user_logged_in() ) {
    				echo '';
    			} else {
    				if ( version_compare( get_bloginfo('version'),'5.4', '<' ) ) {
    					echo do_shortcode( $content);
    				} else {
    					echo apply_shortcodes( $content );
    				}
    			}
    
    			$output = ob_get_clean();
    			return $output;
    }

    Regards,

    Thread Starter daminthi87

    (@daminthi87)

    Sorry, this did not work for me. Your code led to a critical error when used with code snippets plugin.

    What worked for me was to remove wpautop from the um_loggedout code in class-shortcodes.php, but this will be overwritten with the next plugin update I guess. So, seems to be just a temporary solution.

    Any further ideas?

    @daminthi87

    Replace the first line in the code snippet with this line and keep the other lines:

    add_shortcode( 'um_loggedout_v2', 'um_loggedout_v2' );

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @daminthi87

    There was a typo in the code above. Sorry about that. Please try what @missveronicatv suggested.

    Regards,

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hey there!

    This thread has been inactive for a while so we’re going to go ahead and mark it Resolved.

    Please feel free to re-open this thread by changing the Topic Status to ‘Not Resolved’ if any other questions come up and we’d be happy to help. ??

    Regards,

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[um_loggedout] output creates unwanted line break’ is closed to new replies.