
Follow and Profile components
Nostr Components brings the power of Nostr (Notes and Other Stuff Transmitted by Relays) to your WordPress site through modern web components. This plugin provides Gutenberg blocks and shortcodes that allow you to seamlessly integrate Nostr content into your posts and pages.
Gutenberg Blocks:
Simply add the Nostr blocks from the block inserter and configure them in the block settings.
Shortcodes:
[nostr_zap_button pubkey=”npub1abc…” url=””]
[nostr_post eventid=”note1abc…”]
[nostr_profile pubkey=”npub1abc…”]
[nostr_profile_badge pubkey=”npub1abc…”]
[nostr_follow_button pubkey=”npub1abc…”]
[nostr_like_button]
[nostr_livestream naddr=”naddr1abc…”]
To automatically add Like and Zap buttons to the end of every post and page:
functions.phpAdd the following code at the end of the file:
// Add shortcode to the end of every post and page
function add_shortcode_to_content($content) {
// Only add in single posts and pages (not homepage or archives)
if (is_singular(['post', 'page']) && in_the_loop() && is_main_query()) {
$shortcode_1 = do_shortcode('[nostr_like_button]');
$current_url = esc_url(get_permalink());
$shortcode_2 = do_shortcode('[nostr_zap_button npub="[YOUR-NPUB-GOES-HERE]" url="' . $current_url . '"]');
$content .= '<div class="nostr-shortcode-wrapper">' . $shortcode_1 . '<br/><br/>' . $shortcode_2 . '</div>';
}
return $content;
}
add_filter('the_content', 'add_shortcode_to_content');
Important Notes:
* Replace [YOUR-NPUB-GOES-HERE] with your actual Nostr public key (npub format)
* Always use a child theme when modifying theme files to preserve changes during theme updates
* The buttons will only appear on single post and page views, not on archive pages or the homepage
This plugin is developed as part of the Nostr Components project. For development, bug reports, and feature requests, please visit the GitHub repository.
For support, please visit the GitHub repository or create an issue.
This plugin does not collect, store, or transmit any personal data. All Nostr data is fetched directly from public relays and displayed locally on your site. If components fetch data client‑side, visitors’ browsers may directly connect to configured relays (exposing their IP and user agent to those relays). Configure trusted relays accordingly.