diff --git a/includes/widgets/displayfeaturedimagegenesis-author-widget.php b/includes/widgets/displayfeaturedimagegenesis-author-widget.php index 10e353b..3eee039 100644 --- a/includes/widgets/displayfeaturedimagegenesis-author-widget.php +++ b/includes/widgets/displayfeaturedimagegenesis-author-widget.php @@ -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; - } } diff --git a/includes/widgets/fields/author-archive.php b/includes/widgets/fields/author-archive.php index cbdb793..fad3642 100644 --- a/includes/widgets/fields/author-archive.php +++ b/includes/widgets/fields/author-archive.php @@ -1,5 +1,21 @@ '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(