Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,13 @@
</div>
<div class="plugin-actions">
<?php
/**
* Retrieve the plugin donate link.
*
* @var string $donate_link The donation URL from post meta.
*/
$donate_link = get_post_meta( get_the_ID(), 'donate_link', true );

$buttons = '<!-- wp:wporg/favorite-button /-->';

if ( 'publish' === get_post_status() || current_user_can( 'plugin_admin_view', $post ) ) {
Expand Down Expand Up @@ -77,6 +84,15 @@
esc_html__( 'Test Preview', 'wporg-plugins' )
);
}
if ( $donate_link ) {
$buttons .= sprintf(
'<!-- wp:button {"className":"is-small is-style-outline plugin-donate download-button"} -->
<div class="wp-block-button is-small is-style-outline plugin-donate download-button"><a class="wp-block-button__link wp-element-button" href="%1$s">%2$s</a></div>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the right way to do the html. Are those classes default

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I've followed the button HTML structure consistent with the existing elements such as Download, Live Preview, and Test Preview.

<!-- /wp:button -->',
esc_url( $donate_link ),
esc_html__( 'Donate', 'wporg-plugins' )
);
}
echo do_blocks( $buttons ); // phpcs:ignore -- Output escaped while building string.
?>
</div>
Expand Down