コード例 #1
0
 /**
  * Default login form if there's no login template found
  */
 public function insert_login_form($content)
 {
     // bail if we aren't on the login page
     if (!is_admin() && !is_page('login') && !is_page(wds_login_slug())) {
         return $content;
     }
     // if there's a defined login page already in the theme, let that page template deal with the login form
     if (locate_template('page-login.php', false, false) || locate_template('page-' . wds_login_slug(), false, false)) {
         return $content;
     }
     // if there's a template file matching either template-login.php or template-{login page slug}.php, let that page template deal with the login form
     if ('template-login.php' == get_post_meta(get_the_ID(), '_wp_page_template', true) || 'template-' . wds_login_slug() == get_post_meta(get_the_ID(), '_wp_page_template', true)) {
         return $content;
     }
     // return the post content (if there is any), the message (if there is any), and the login form with the passed args
     return $content . $this->render_login_form();
 }
コード例 #2
0
 /**
  * Add the options metabox to the array of metaboxes
  * @since  0.1.0
  */
 function add_options_page_metabox()
 {
     $cmb = new_cmb2_box(array('id' => $this->metabox_id, 'hookup' => false, 'show_on' => array('key' => 'options-page', 'value' => array($this->key))));
     // Set our CMB2 fields
     $cmb->add_field(array('name' => __('Login Page', 'maintainn'), 'desc' => __('field description (optional)', 'maintainn'), 'id' => 'login_slug', 'type' => 'select', 'options' => $this->get_page_list(), 'default' => wds_login_slug()));
 }