Merge branch 'trunk' into improve/actor-mode

This commit is contained in:
Matt Wiebe 2024-10-16 12:58:41 -05:00 committed by GitHub
commit 7bb5b6bd9e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 3 deletions

View file

@ -163,13 +163,13 @@ class Activitypub {
$self_link = esc_url( $self_link );
if ( ! headers_sent() ) {
header( 'Link: <' . $self_link . '>; rel="alternate"; type="application/activity+json"' );
header( 'Link: <' . $self_link . '>; title="ActivityPub (JSON)" rel="alternate"; type="application/activity+json"' );
}
add_action(
'wp_head',
function () use ( $self_link ) {
echo PHP_EOL . '<link rel="alternate" type="application/activity+json" href="' . esc_url( $self_link ) . '" />' . PHP_EOL;
echo PHP_EOL . '<link rel="alternate" title="ActivityPub (JSON)" type="application/activity+json" href="' . esc_url( $self_link ) . '" />' . PHP_EOL;
}
);
}

View file

@ -156,7 +156,11 @@ class Replies {
$total_replies = \get_comments( array_merge( $args, array( 'count' => true ) ) );
// Modify query args to retrieve paginated results.
$comments_per_page = \get_option( 'comments_per_page' );
$comments_per_page = (int) \get_option( 'comments_per_page' );
// If set to zero, we get errors below. You need at least one comment per page, here.
if ( ! $comments_per_page ) {
$comments_per_page = 1;
}
// Fetch internal and external comments for current page.
$comments = get_comments( self::add_pagination_args( $args, $page, $comments_per_page ) );