Skip to content

Commit d6095d0

Browse files
Add menu_order to ap_extrafield so that user can decide in with order they will be displayed (#827)
Co-authored-by: Matthias Pfefferle <[email protected]>
1 parent 353d848 commit d6095d0

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

includes/class-activitypub.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,7 @@ private static function register_post_types() {
527527
'show_in_rest' => true,
528528
'map_meta_cap' => true,
529529
'show_ui' => true,
530-
'supports' => array( 'title', 'editor' ),
530+
'supports' => array( 'title', 'editor', 'page-attributes' ),
531531
)
532532
);
533533

@@ -573,6 +573,7 @@ public static function default_actor_extra_fields( $extra_fields, $user_id ) {
573573
\__( 'Homepage', 'activitypub' ) => \get_the_author_meta( 'user_url', $user_id ),
574574
);
575575

576+
$menu_order = 10;
576577
foreach ( $defaults as $title => $url ) {
577578
if ( ! $url ) {
578579
continue;
@@ -590,8 +591,10 @@ public static function default_actor_extra_fields( $extra_fields, $user_id ) {
590591
\wp_parse_url( $url, \PHP_URL_HOST )
591592
),
592593
'comment_status' => 'closed',
594+
'menu_order' => $menu_order,
593595
);
594596

597+
$menu_order += 10;
595598
$extra_field_id = wp_insert_post( $extra_field );
596599
$extra_fields[] = get_post( $extra_field_id );
597600
}

includes/functions.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1052,6 +1052,8 @@ function get_actor_extra_fields( $user_id ) {
10521052
'nopaging' => true,
10531053
'status' => 'publish',
10541054
'author' => $user_id,
1055+
'orderby' => 'menu_order',
1056+
'order' => 'ASC',
10551057
)
10561058
);
10571059

0 commit comments

Comments
 (0)