Astra Author Info Box
Lightweight WordPress plugin that renders a polished author info box on single post pages. Optimized for the Astra theme with configurable placement, avatar, social links, and appearance settings.
by Codexpert · github.com/mralaminahamed/astra-author-box · website
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/mralaminahamed/astra-author-box/archive/refs/heads/trunk.zipReadme
Astra Author Info Box
Lightweight WordPress plugin that inserts a polished author information box on single post pages, designed to complement the Astra theme.
What It Does
Displays author avatar, name, bio, post count, and social profile links after (or before) single post content. Hooks directly into Astra theme action hooks so the box renders outside .entry-content — on non-Astra themes it falls back to the the_content filter.
Features
- Gravatar / user avatar — configurable size and shape (square, rounded, circle)
- Author name, bio, and post count — each element individually toggleable
- Social profile links — Website, Twitter/X, Facebook, LinkedIn, YouTube
- 3 box styles — Card (shadow), Flat (border), Minimal (accent stripe)
- 6 placement options — top, before/after content, bottom, before/after pagination
- Dark-mode aware — detects Astra's
ast-dark-modebody class +prefers-color-scheme - Responsive — single-column layout on mobile
- Settings page under Settings → Author Info Box with three tabs
Requirements
- WordPress 5.0+
- PHP 7.4+
- Astra theme (recommended; non-Astra themes supported via fallback)
Installation
Manual
- Upload the
astra-author-boxfolder to/wp-content/plugins/. - Activate via Plugins → Installed Plugins.
- Go to Settings → Author Info Box to configure.
WP-CLI
wp plugin activate astra-author-box
Settings
Configured under Settings → Author Info Box, organized into three tabs:
Placement
- Placement point: top, before content, after content, bottom, before pagination, after pagination
- Enable on specific post types
- Top / bottom margin (px)
- Max width (px) — 0 for full container width
Elements
- Avatar — show/hide, size (40–200 px), shape (square / rounded / circle)
- Eyebrow label — show/hide + custom text (e.g. "About the author")
- Author name — show/hide
- Post count — show/hide
- Biography — show/hide
- Social links — master toggle + per-network toggles
Appearance
- Box style: Card / Flat / Minimal
- Accent color (color picker)
Social Links
Each author manages their own social URLs from their WordPress profile:
- Go to Users → Your Profile.
- Scroll to Social Profiles (Author Info Box).
- Fill in URLs and save.
The Website field uses WordPress's built-in user_url. All other networks store URLs in user meta under the key aab_{network} (e.g. aab_twitter).
Placement (technical)
| Setting | Astra hook | Priority |
|---|---|---|
| Top of post | astra_entry_top |
10 |
| Before content | astra_entry_content_before |
10 |
| After content | astra_entry_content_after |
10 |
| Bottom of post | astra_entry_bottom |
10 |
| Before pagination | astra_entry_after |
5 |
| After pagination | astra_entry_after |
15 |
Astra's prev/next navigation hooks to astra_entry_after at priority 10, so priority 5 lands before it and priority 15 after it. On non-Astra themes the box falls back to the the_content filter and receives the aab-fallback CSS class.
Extensibility
Hooks & Filters
| Hook | Type | Description |
|---|---|---|
aab/render_box |
filter | Receives full HTML string — return modified version |
aab/should_render |
filter | Return false to suppress the box |
aab/social_networks |
filter | Add, remove, or modify social network definitions |
aab/template_path |
filter | Override any template file path |
// Suppress the box on a specific post
add_filter( 'aab/should_render', function( $result ) {
return is_singular() && get_the_ID() === 42 ? false : $result;
} );
// Add a custom social network
add_filter( 'aab/social_networks', function( $networks ) {
$networks['github'] = [
'meta' => 'aab_github',
'label' => 'GitHub',
'icon' => '<svg ...>...</svg>',
];
return $networks;
} );
Override Accent Colour
Accent colour is injected as --aab-accent on the box element, overridable from any stylesheet:
.aab-author-box { --aab-accent: #e74c3c; }
Template Overrides
Filter aab/template_path to swap any template with a custom file:
add_filter( 'aab/template_path', function( $file, $template ) {
if ( 'frontend/author-box' === $template ) {
return get_stylesheet_directory() . '/author-box.php';
}
return $file;
}, 10, 2 );
Adding a Social Network
- Add an entry to
includes/social-networks.phpwithmeta,label, andiconkeys. - Add the corresponding field to
AAB_Profile_Fields::$fields. - Add the per-network toggle to
AAB_Settings::sanitize()andAAB_Settings::defaults(). - Add the toggle checkbox to
templates/admin/settings-page.php.
Architecture
astra-author-box/
├── astra-author-box.php Bootstrap + aab_get_template() helper
├── assets/css/
│ ├── admin.css Settings page styling
│ └── author-box.css Front-end styling (CSS custom properties)
├── includes/
│ ├── class-aab-settings.php Option storage, sanitisation, admin assets
│ ├── class-aab-renderer.php Placement hooks, data assembly
│ ├── class-aab-profile-fields.php Social URL fields on the WP user profile screen
│ └── social-networks.php Social network definitions (icons + meta keys)
└── templates/
├── admin/
│ ├── settings-page.php Settings page markup
│ └── profile-fields.php Profile fields markup
└── frontend/
├── author-box.php Author box markup
└── social-links.php Social icons partial
Strict HTML/logic split. Classes hold zero HTML. All markup lives in templates/. Data flows from class → aab_get_template( 'path', [ $vars ] ) → template.
Settings are stored as a single serialised array under the aab_settings option key. Always use AAB_Settings::get( $key ) — it merges stored values with defaults.
Changelog
1.4.0
- Extracted all HTML out of PHP classes into
templates/tree - Added
aab_get_template()loader withaab/template_pathoverride filter - Moved social network definitions to
includes/social-networks.php(filterable viaaab/social_networks)
1.3.0
- Added before/after pagination placements via hook priority on
astra_entry_after - Restyled the admin settings page
1.2.1
- Added Settings link to the plugin row on the Plugins page
1.2.0
- Tabbed settings page (Placement / Elements / Appearance)
1.1.0
- Box renders outside post content container on Astra; automatic detection + fallback
1.0.0
- Initial release
License
GPL v2 or later. See https://www.gnu.org/licenses/gpl-2.0.html.
Author
Codexpert — codexpert.io