How to add HTML to a template only when user is logged out/ not registered

First of all, your shortcode usage code is incorrect, correct code is: echo do_shortcode(‘[loginout_button]’); Now, if you want to echo the login/logout button only when user is not logged in, you can use the function is_user_logged_in(). There are two ways to do this 1). Conditional logic inside your shortcode. add_shortcode(‘loginout_button’,’add_loginout_button’); function add_loginout_button() { if ( … Read more

Sanitize AROUND shortcode

Try to use this instead: editor.focus(); var selected_text = editor.selection.getContent(); shortcode=”[checklist-box title=”” + e.data.title + ‘”]’ + selected_text + ‘[/checklist-box]’; editor.selection.setContent(shortcode); editor.setContent(editor.getContent()); Basically, I’m first forcing editor focus and then use setContent instead to change the content. In my tests there were still some glitches on the editor but the source was ok, so I … Read more