Move page choices

This commit is contained in:
Robin Cornett
2019-06-24 10:35:05 -04:00
parent ab86156af5
commit 0c36f0ce56
2 changed files with 17 additions and 22 deletions
@@ -159,25 +159,4 @@ class Display_Featured_Image_Genesis_Author_Widget extends WP_Widget {
return $options;
}
/**
* Get the pages on the site.
*
* @return array
*/
protected function get_pages() {
$page_ids = get_pages( array(
'post_type' => 'page',
) );
$pages = array();
if ( $page_ids ) {
$pages[] = __( 'None', 'display-featured-image-genesis' );
foreach ( $page_ids as $id ) {
$title = empty( $id->post_title ) ? '#' . $id->ID . __( ' (no title)', 'sixtenpress-featured-content' ) : $id->post_title;
$pages[ $id->ID ] = $title;
}
}
return $pages;
}
}
+17 -1
View File
@@ -1,5 +1,21 @@
<?php
$page_ids = get_pages(
array(
'post_type' => 'page',
)
);
$page_choices = array(
'' => __( 'None', 'display-featured-image-genesis' ),
);
if ( $page_ids ) {
foreach ( $page_ids as $page_id ) {
// phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
$title = empty( $page_id->post_title ) ? '#' . $page_id->ID . __( ' (no title)', 'sixtenpress-featured-content' ) : $page_id->post_title;
$page_choices[ $page_id->ID ] = $title;
}
}
/**
* Define author specific archive fields.
*/
@@ -9,7 +25,7 @@ return array(
'args' => array(
'id' => 'page',
'label' => __( 'Choose your extended "About Me" page from the list below. This will be the page linked to at the end of the author description.', 'display-featured-image-genesis' ),
'choices' => $this->get_pages(),
'choices' => $page_choices,
),
),
array(