mirror of
git://develop.git.wordpress.org/
synced 2025-01-18 05:18:42 +01:00
Privacy: On Privacy Settings screen, check if any pages exist before displaying the page selector.
Props abdullahramzan, desrosj, melchoyce. Merges [43238] to the 4.9 branch. Fixes #43940. git-svn-id: https://develop.svn.wordpress.org/branches/4.9@43239 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
1995d39556
commit
8a6f1d8078
@ -167,32 +167,50 @@ require_once( ABSPATH . 'wp-admin/admin-header.php' );
|
||||
?>
|
||||
</th>
|
||||
<td>
|
||||
<form method="post" action="">
|
||||
<label for="page_for_privacy_policy">
|
||||
<?php _e( 'Either select an existing page:' ); ?>
|
||||
</label>
|
||||
<input type="hidden" name="action" value="set-privacy-page" />
|
||||
<?php
|
||||
wp_dropdown_pages(
|
||||
array(
|
||||
'name' => 'page_for_privacy_policy',
|
||||
'show_option_none' => __( '— Select —' ),
|
||||
'option_none_value' => '0',
|
||||
'selected' => $privacy_policy_page_id,
|
||||
'post_status' => array( 'draft', 'publish' ),
|
||||
)
|
||||
);
|
||||
<?php
|
||||
$has_pages = (bool) get_posts( array(
|
||||
'post_type' => 'page',
|
||||
'posts_per_page' => 1,
|
||||
'post_status' => array(
|
||||
'publish',
|
||||
'draft',
|
||||
),
|
||||
) );
|
||||
|
||||
wp_nonce_field( 'set-privacy-page' );
|
||||
if ( $has_pages ) : ?>
|
||||
<form method="post" action="">
|
||||
<label for="page_for_privacy_policy">
|
||||
<?php _e( 'Select an existing page:' ); ?>
|
||||
</label>
|
||||
<input type="hidden" name="action" value="set-privacy-page" />
|
||||
<?php
|
||||
wp_dropdown_pages(
|
||||
array(
|
||||
'name' => 'page_for_privacy_policy',
|
||||
'show_option_none' => __( '— Select —' ),
|
||||
'option_none_value' => '0',
|
||||
'selected' => $privacy_policy_page_id,
|
||||
'post_status' => array( 'draft', 'publish' ),
|
||||
)
|
||||
);
|
||||
|
||||
submit_button( __( 'Use This Page' ), 'primary', 'submit', false, array( 'id' => 'set-page' ) );
|
||||
?>
|
||||
</form>
|
||||
wp_nonce_field( 'set-privacy-page' );
|
||||
|
||||
submit_button( __( 'Use This Page' ), 'primary', 'submit', false, array( 'id' => 'set-page' ) );
|
||||
?>
|
||||
</form>
|
||||
<?php endif; ?>
|
||||
|
||||
<form method="post" action="">
|
||||
<input type="hidden" name="action" value="create-privacy-page" />
|
||||
<span>
|
||||
<?php _e( 'Or create a new page:' ); ?>
|
||||
<?php
|
||||
if ( $has_pages ) {
|
||||
_e( 'Or:' );
|
||||
} else {
|
||||
_e( 'There are no pages.' );
|
||||
}
|
||||
?>
|
||||
</span>
|
||||
<?php
|
||||
wp_nonce_field( 'create-privacy-page' );
|
||||
|
Loading…
x
Reference in New Issue
Block a user