-
Notifications
You must be signed in to change notification settings - Fork 174
Donation Visibility: Add Donate Button Near Download on Plugin Page #484
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: trunk
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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 ) ) { | ||
|
|
@@ -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> | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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> | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.