Last active
February 7, 2024 13:52
-
-
Save ipokkel/313499792cdb69be25930caccd0ca968 to your computer and use it in GitHub Desktop.
Add custom content to the PMPro login form.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Add custom HTML at the begining of the PMPro login form. | |
* | |
* You can add this recipe to your site by creating a custom plugin | |
* or using the Code Snippets plugin available for free in the WordPress repository. | |
* Read this companion article for step-by-step directions on either method. | |
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function my_pmpro_login_custom_html_content( $content ) { | |
#--- SETTINGS ---# | |
// Enter your custom HTML content/message here: | |
$html = '<p class="login-content">Your HTML content here</p>'; | |
#--- END SETTINGS ---# | |
/* That's it, no further editing required */ | |
// Let's only do this if PMPro is active | |
if ( ! defined( 'PMPRO_VERSION' ) ) { | |
return $content; | |
} | |
// Are we on the PMPro login page | |
if ( pmpro_getOption( 'login_page_id' ) && is_page( pmpro_getOption( 'login_page_id' ) ) ) { | |
// Lets add in our custom HTML at the beginning. | |
$content = $html . $content; | |
} | |
return $content; | |
} | |
add_filter( 'login_form_top', 'my_pmpro_login_custom_html_content' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment