show_blog_form

Generates and displays the Signup and Create Site forms.

Description

show_blog_form( (string) $blogname = '', (string) $blog_title = '', (string) $errors = '' ); 

Parameters (3)

0. $blogname — Optional. (string) => ''
The new site name.
1. $blog_title — Optional. (string) => ''
The new site title.
2. $errors — Optional. (string) => ''
A WP_Error object containing existing errors. Defaults to empty string.

Usage

  1. if ( !function_exists( 'show_blog_form' ) ) { 
  2. require_once '/wp-signup.php'; 
  3.  
  4. // The new site name. 
  5. $blogname = ''; 
  6.  
  7. // The new site title. 
  8. $blog_title = ''; 
  9.  
  10. // A WP_Error object containing existing errors. Defaults to empty string. 
  11. $errors = ''; 
  12.  
  13. // NOTICE! Understand what this does before running. 
  14. $result = show_blog_form($blogname, $blog_title, $errors); 
  15.  

Defined (1)

The function is defined in the following location(s).

/wp-signup.php  
  1. function show_blog_form( $blogname = '', $blog_title = '', $errors = '' ) { 
  2. if ( ! is_wp_error( $errors ) ) { 
  3. $errors = new WP_Error(); 
  4.  
  5. $current_network = get_network(); 
  6. // Blog name 
  7. if ( !is_subdomain_install() ) 
  8. echo '<label for="blogname">' . __('Site Name:') . '</label>'; 
  9. else 
  10. echo '<label for="blogname">' . __('Site Domain:') . '</label>'; 
  11.  
  12. if ( $errmsg = $errors->get_error_message('blogname') ) { ?> 
  13. <p class="error"><?php echo $errmsg ?></p> 
  14. <?php } 
  15.  
  16. if ( !is_subdomain_install() ) 
  17. echo '<span class="prefix_address">' . $current_network->domain . $current_network->path . '</span><input name="blogname" type="text" id="blogname" value="'. esc_attr($blogname) .'" maxlength="60" /><br />'; 
  18. else 
  19. echo '<input name="blogname" type="text" id="blogname" value="'.esc_attr($blogname).'" maxlength="60" /><span class="suffix_address">.' . ( $site_domain = preg_replace( '|^www\.|', '', $current_network->domain ) ) . '</span><br />'; 
  20.  
  21. if ( ! is_user_logged_in() ) { 
  22. if ( ! is_subdomain_install() ) { 
  23. $site = $current_network->domain . $current_network->path . __( 'sitename' ); 
  24. } else { 
  25. $site = __( 'domain' ) . '.' . $site_domain . $current_network->path; 
  26.  
  27. /** translators: %s: site address */ 
  28. echo '<p>(<strong>' . sprintf( __( 'Your address will be %s.' ), $site ) . '</strong>) ' . __( 'Must be at least 4 characters, letters and numbers only. It cannot be changed, so choose carefully!' ) . '</p>'; 
  29.  
  30. // Blog Title 
  31. ?> 
  32. <label for="blog_title"><?php _e('Site Title:') ?></label> 
  33. <?php if ( $errmsg = $errors->get_error_message('blog_title') ) { ?> 
  34. <p class="error"><?php echo $errmsg ?></p> 
  35. <?php } 
  36. echo '<input name="blog_title" type="text" id="blog_title" value="'.esc_attr($blog_title).'" />'; 
  37. ?> 
  38.  
  39. <?php 
  40. // Site Language. 
  41.  
  42. if ( ! empty( $languages ) ) : 
  43. ?> 
  44. <p> 
  45. <label for="site-language"><?php _e( 'Site Language:' ); ?></label> 
  46. <?php 
  47. // Network default. 
  48. $lang = get_site_option( 'WPLANG' ); 
  49.  
  50. if ( isset( $_POST['WPLANG'] ) ) { 
  51. $lang = $_POST['WPLANG']; 
  52.  
  53. // Use US English if the default isn't available. 
  54. if ( ! in_array( $lang, $languages ) ) { 
  55. $lang = ''; 
  56.  
  57. 'name' => 'WPLANG',  
  58. 'id' => 'site-language',  
  59. 'selected' => $lang,  
  60. 'languages' => $languages,  
  61. 'show_available_translations' => false,  
  62. ) ); 
  63. ?> 
  64. </p> 
  65. <?php endif; // Languages. ?> 
  66.  
  67. <div id="privacy"> 
  68. <p class="privacy-intro"> 
  69. <label for="blog_public_on"><?php _e('Privacy:') ?></label> 
  70. <?php _e( 'Allow search engines to index this site.' ); ?> 
  71. <br style="clear:both" /> 
  72. <label class="checkbox" for="blog_public_on"> 
  73. <input type="radio" id="blog_public_on" name="blog_public" value="1" <?php if ( !isset( $_POST['blog_public'] ) || $_POST['blog_public'] == '1' ) { ?>checked="checked"<?php } ?> /> 
  74. <strong><?php _e( 'Yes' ); ?></strong> 
  75. </label> 
  76. <label class="checkbox" for="blog_public_off"> 
  77. <input type="radio" id="blog_public_off" name="blog_public" value="0" <?php if ( isset( $_POST['blog_public'] ) && $_POST['blog_public'] == '0' ) { ?>checked="checked"<?php } ?> /> 
  78. <strong><?php _e( 'No' ); ?></strong> 
  79. </label> 
  80. </p> 
  81. </div> 
  82.  
  83. <?php 
  84. /** 
  85. * Fires after the site sign-up form. 
  86. * @since 3.0.0 
  87. * @param WP_Error $errors A WP_Error object possibly containing 'blogname' or 'blog_title' errors. 
  88. */