Title: do_shortcode
Last modified: September 1, 2016

---

# do_shortcode

 *  Resolved [Stephen](https://wordpress.org/support/users/idiots_guide/)
 * (@idiots_guide)
 * [9 years, 9 months ago](https://wordpress.org/support/topic/do_shortcode-10/)
 * I can make the do_shortcode works in template, codes are copied from `clean_login_load_before_headers();`.
   My post do not content any shortcode. Is there any better way, more simpler than
   this?
 *     ```
       $url = clean_login_url_cleaner( wp_get_referer() );
       // LOGIN
       if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'login' ) {
       	$url = get_option( 'cl_login_url', '');
       	$user = wp_signon();
       	if ( is_wp_error( $user ) )
       		$url = esc_url( add_query_arg( 'authentication', 'failed', $url ) );
       	else {
       		// if the user is disabled
       		if( empty($user->roles) ) {
       			wp_logout();
       			$url = esc_url( add_query_arg( 'authentication', 'disabled', $url ) );
       		}
       		else
       			$url = get_option('cl_login_redirect', false) ? esc_url(get_option('cl_login_redirect_url')): esc_url( add_query_arg( 'authentication', 'success', $url ) );
       	}
       	wp_safe_redirect( $url );
       }
   
       get_header();
   
       if( !is_user_logged_in() ){
       	echo do_shortcode('[clean-login]');
       }
       ```
   
 * [https://wordpress.org/plugins/clean-login/](https://wordpress.org/plugins/clean-login/)

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [Alberto Hornero](https://wordpress.org/support/users/hornero/)
 * (@hornero)
 * [9 years, 9 months ago](https://wordpress.org/support/topic/do_shortcode-10/#post-7633237)
 * IMHO, that’s the easiest way! Thanks for sharing with the community 🙂
 * Alberto.
 *  Thread Starter [Stephen](https://wordpress.org/support/users/idiots_guide/)
 * (@idiots_guide)
 * [9 years, 9 months ago](https://wordpress.org/support/topic/do_shortcode-10/#post-7633256)
 * OK Thank you.
 * Maybe this only useful for people who are not interested to using shortcode in
   their posts.
 * So the `do_shortcode` need a helper to get the default value of login_url, edit_url,
   register_url and restore_url.
 * I made a little addition to the clean-login.php.
 * After first appearance of `$logoutredirect_url`, add:
 *     ```
       $login_url_man = get_option( 'cl_login_url_man' );
       $edit_url_man = get_option( 'cl_edit_url_man' );
       $register_url_man = get_option( 'cl_register_url_man' );
       $restore_url_man = get_option( 'cl_restore_url_man' );
       ```
   
 * inside
    `if( isset($_POST[ $hidden_field_name ]) && $_POST[ $hidden_field_name]
   == $hidden_field_value ) {`
 * add:
 *     ```
       update_option( 'cl_login_url_man', isset( $_POST['login_url_man'] ) ? get_permalink($_POST['login_url_man']) : '' );
       update_option( 'cl_edit_url_man', isset( $_POST['edit_url_man'] ) ? get_permalink($_POST['edit_url_man']) : '' );
       update_option( 'cl_register_url_man', isset( $_POST['register_url_man'] ) ? get_permalink($_POST['register_url_man']) : '' );
       update_option( 'cl_restore_url_man', isset( $_POST['restore_url_man'] ) ? get_permalink($_POST['restore_url_man']) : '' );
       ```
   
 * Then inside `form name="form1"`, for each variable above, add:
 *     ```
       <label style="display:block;" for="login_url_man">Login Form URL (cl_login_url_man)</label>
       	<?php
       	$postid_url = url_to_postid( $login_url_man );
       	wp_dropdown_pages(array(
       		'id'=>'login_url_man',
       		'name'=>'login_url_man',
       		'selected'=>$postid_url,
       		'show_option_none'=>'Select Login Form URL'
       	));
       	?>
       <p> </p>
       ```
   
 * and so on. for the rest.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘do_shortcode’ is closed to new replies.

 * ![](https://ps.w.org/clean-login/assets/icon-256x256.png?rev=1602118)
 * [Clean Login](https://wordpress.org/plugins/clean-login/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/clean-login/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/clean-login/)
 * [Active Topics](https://wordpress.org/support/plugin/clean-login/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/clean-login/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/clean-login/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [Stephen](https://wordpress.org/support/users/idiots_guide/)
 * Last activity: [9 years, 9 months ago](https://wordpress.org/support/topic/do_shortcode-10/#post-7633256)
 * Status: resolved