concept-image / wp-social-nav
Social network links for Concept Image Acorn themes: a <x-social-nav> component, a "Réseaux sociaux" ACF options page and the network icons, published into the theme by `social-nav:install`, unused icons removed by `social-nav:clean`.
Requires
- php: >=8.3
- concept-image/wp-hook-attributes: ^0.1
- roots/acorn: ^6.1
Requires (Dev)
- brain/monkey: ^2.6
- larastan/larastan: ^3.0
- laravel/pint: ^1.18
- log1x/acf-composer: ^3.4
- orchestra/testbench: ^10.0|^11.0
- pestphp/pest: ^4.0|^5.0
- pestphp/pest-plugin-arch: ^4.0|^5.0
- szepeviktor/phpstan-wordpress: ^2.0
Suggests
- log1x/acf-composer: Registers the published "Réseaux sociaux" options page (app/Options/SocialOptions.php).
Provides
None
Conflicts
None
Replaces
None
README
Social network links for Acorn WordPress themes
For Concept Image themes (Bedrock + Sage): a <x-social-nav> Blade component, a
"Réseaux sociaux" ACF options page and the network icons, published into the theme and owned by it. One list of
networks in config/social-nav.php drives the admin select, the icons and the rendering. Unknown networks and unsafe
URLs are never rendered. Admin labels are French, with English translations included.
Requirements
- PHP 8.3+
- Roots Acorn 6.1+
concept-image/wp-hook-attributes^0.1 (installed with the package)- ACF Pro and
log1x/acf-composerfor the options page (both come with wp-starter-theme) - wp-starter-theme's sprite system for the icons (
mask-sprite-*utilities,sprites.css)
Installation
wp-header and wp-footer-base already require the package. Otherwise:
composer require concept-image/wp-social-nav
Then, from the Bedrock root:
wp acorn social-nav:install
It copies into the theme:
| File | Role |
|---|---|
app/View/Components/SocialNav.php | The <x-social-nav> component |
resources/views/components/social-nav.blade.php | Its view (Tailwind) |
app/Options/SocialOptions.php | "Réseaux sociaux" options page, under "Autres contenus" (general-options) |
config/social-nav.php | The networks, value => label, in display order |
resources/images/icons/social/*.svg | The icons of the configured networks |
Existing files are kept (--force overwrites them). The command then warns about networks without an icon and prints
the --sprite-* lines missing from resources/styles/src/components/sprites.css.
Once the site's networks are set in config/social-nav.php, wp acorn social-nav:clean --dry-run, then
wp acorn social-nav:clean, removes the other icons from the theme (and from the sprite map).
Usage
<x-social-nav />
<x-social-nav class="justify-center gap-5" />
<x-social-nav :socials="$shop_social_links" />
Without socials, the component renders the rows of the options page. Read them elsewhere with
get_field('social_media_link', 'option') (rows social_type and link), or with safe URLs through
app(ConceptImage\WpSocialNav\SocialLinks::class)->fromOptions().
Networks
| Value | Label |
|---|---|
facebook | |
linkedin | |
x | X (Twitter) |
instagram | |
youtube | YouTube |
tiktok | TikTok |
bluesky | Bluesky |
mastodon | Mastodon |
threads | Threads |
vimeo | Vimeo |
welcome-to-the-jungle | Welcome to the Jungle |
spotify | Spotify |
whatsapp | |
twitch | Twitch |
pinterest |
The list suits French corporate, educational and medical sites: Bluesky and Mastodon are where many universities, hospitals and public bodies moved from X, Welcome to the Jungle carries the employer brand, Vimeo and Spotify carry corporate videos and podcasts, Pinterest suits training, recipe or design content.
To add a network, add a line to the theme's config/social-nav.php ('doctolib' => 'Doctolib'), its SVG to
resources/images/icons/social/doctolib.svg, and --sprite-doctolib: url("/__spritemap#sprite-doctolib-view"); to
sprites.css. Never rename or remove a value already used: saved rows keep it.
Commands
| Command | Does |
|---|---|
wp acorn social-nav:install [--force] | Copies the component, view, options page, config and icons into the theme, then reports missing icons and sprite variables |
wp acorn social-nav:clean [--dry-run] [--force] | Deletes the theme icons of networks absent from config/social-nav.php (asks first; --dry-run lists them), then lists the --sprite-* lines to remove. social-nav:install restores an icon once its network is configured again |
wp acorn vendor:publish --tag=wp-social-nav | The same files without the report (2.x tag, run by wp-header and wp-footer-base) |
Customizing
The published files are project code: change the classes of the view (bg-primary hocus:bg-secondary colours the
icon, which is a CSS mask; w-6 sizes it), the page capability, the networks. Keep the field names
social_media_link, social_type and link: saved values are stored under their keys.
Translations
Admin strings are written in French (text domain wp-social-nav). The package ships languages/wp-social-nav.pot and
English translations (en_US, en_GB, used for every en_* locale), loaded on init.
Claude Code
wp acorn starter:ai (wp-starter-theme) publishes the wp-social-nav skill and rules into the project's .claude/;
alone: wp acorn vendor:publish --tag=wp-social-nav-ai.
Upgrading
From 2.x: see UPGRADE. Files published by 2.x keep working unchanged.
Development
composer install
composer ci # Pint, Larastan (src/), PHPStan (components/), Pest
Changelog
See CHANGELOG.
Contributing
Contributions are welcome! Please submit a merge request or open an issue to discuss what you would like to change. See CONTRIBUTING.
License
This package is open-sourced software licensed under the MIT license. Please see License File for more information.
Credits
- Network icons added in 3.0: Simple Icons (CC0 1.0). Brand names and logos belong to their owners.
- Banner icon: Isometric icons created by Magnific - Flaticon