avatar and header-image settings

This commit is contained in:
Matthias Pfefferle 2023-05-30 15:19:05 +02:00
parent 7b9b3dbc37
commit 4d8170413b
3 changed files with 69 additions and 1 deletions

View file

@ -155,3 +155,24 @@ summary {
input.blog-user-identifier {
text-align: right;
}
.activitypub-settings-body
.header-image {
width: 100%;
height: 80px;
position: relative;
display: block;
margin-bottom: 40px;
background-image: rgb(168,165,175);
background-image: linear-gradient(180deg, red, yellow);
background-size: cover;
}
.activitypub-settings-body
.logo {
height: 80px;
width: 80px;
position: relative;
top: 40px;
left: 40px;
}

View file

@ -28,6 +28,8 @@ class Activitypub {
\add_action( 'untrash_post', array( self::class, 'untrash_post' ), 1 );
\add_action( 'init', array( self::class, 'add_rewrite_rules' ) );
\add_action( 'after_setup_theme', array( self::class, 'theme_compat' ), 99 );
}
/**
@ -242,4 +244,31 @@ class Activitypub {
self::add_rewrite_rules();
\flush_rewrite_rules();
}
public static function theme_compat() {
$site_icon = get_theme_support( 'custom-logo' );
if ( ! $site_icon ) {
// custom logo support
add_theme_support(
'custom-logo',
array(
'height' => 80,
'width' => 80,
)
);
}
$custom_header = get_theme_support( 'custom-header' );
if ( ! $custom_header ) {
// This theme supports a custom header
$custom_header_args = array(
'width' => 1250,
'height' => 600,
'header-text' => true,
);
add_theme_support( 'custom-header', $custom_header_args );
}
}
}

View file

@ -32,7 +32,25 @@
<h3><?php \esc_html_e( 'Blog-User', 'activitypub' ); ?></h3>
<p><?php \esc_html_e( 'All activity related settings.', 'activitypub' ); ?></p>
<p><?php \esc_html_e( 'All settings for the Blog-User (Catch-All Account)', 'activitypub' ); ?></p>
<table class="form-table" id="activitypub-images">
<tbody>
<tr>
<th scope="row">
<?php \esc_html_e( 'Cover & Avatar', 'activitypub' ); ?>
</th>
<td>
<div class="header-image" style="background-image: url('<?php echo esc_url( get_header_image() ); ?>');">
<img class="logo" src="<?php echo get_site_icon_url(); ?>" />
</div>
<p class="description">
<?php esc_html_e( 'Change cover and avatar in the customizer.', 'activitypub' ); ?>
</p>
</td>
</tr>
</tbody>
</table>
<table class="form-table">
<tbody>