mirror of
https://github.com/10h30/display-featured-image-genesis.git
synced 2026-07-15 20:43:19 +09:00
Change how authors are retrieved for the author widget/block
This commit is contained in:
@@ -89,8 +89,15 @@ class Display_Featured_Image_Genesis_Author_Widget extends WP_Widget {
|
||||
*/
|
||||
public function get_fields( $new_instance ) {
|
||||
$form = new DisplayFeaturedImageGenesisWidgetsForm( $this, $new_instance );
|
||||
$user = array(
|
||||
array(
|
||||
'method' => 'select',
|
||||
'args' => include 'fields/author-user.php',
|
||||
),
|
||||
);
|
||||
|
||||
return array_merge(
|
||||
array( $user ),
|
||||
include 'fields/author-image.php',
|
||||
include 'fields/author-gravatar.php',
|
||||
include 'fields/author-description.php',
|
||||
@@ -114,12 +121,7 @@ class Display_Featured_Image_Genesis_Author_Widget extends WP_Widget {
|
||||
'label' => __( 'Title:', 'display-featured-image-genesis' ),
|
||||
'class' => 'widefat',
|
||||
) );
|
||||
$form->do_select( $instance, array(
|
||||
'id' => 'user',
|
||||
'label' => __( 'Select a user. The email address for this account will be used to pull the Gravatar image.', 'display-featured-image-genesis' ),
|
||||
'flex' => true,
|
||||
'choices' => $this->get_users(),
|
||||
) );
|
||||
$form->do_select( $instance, include 'fields/author-user.php' );
|
||||
|
||||
$form->do_boxes( array(
|
||||
'author' => include 'fields/author-image.php',
|
||||
@@ -138,23 +140,6 @@ class Display_Featured_Image_Genesis_Author_Widget extends WP_Widget {
|
||||
) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the authors on the site.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function get_users() {
|
||||
$users = get_users( array(
|
||||
'who' => 'authors',
|
||||
) );
|
||||
$options = array();
|
||||
foreach ( $users as $user ) {
|
||||
$options[ $user->ID ] = $user->data->display_name;
|
||||
}
|
||||
|
||||
return $options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get gravatar sizes.
|
||||
*
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
$users = get_users(
|
||||
array(
|
||||
'who' => 'authors',
|
||||
)
|
||||
);
|
||||
$options = array();
|
||||
foreach ( $users as $user ) {
|
||||
$options[ $user->ID ] = $user->data->display_name;
|
||||
}
|
||||
|
||||
return array(
|
||||
'id' => 'user',
|
||||
'label' => __( 'Select a user. The email address for this account will be used to pull the Gravatar image.', 'display-featured-image-genesis' ),
|
||||
'flex' => true,
|
||||
'choices' => $options,
|
||||
);
|
||||
Reference in New Issue
Block a user