Created
April 6, 2021 09:20
-
-
Save JarrydLong/76b2587ecb2eaaee42ecd311efaf160d to your computer and use it in GitHub Desktop.
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 | |
/** | |
* This code recipe will create a shortcode that returns an image based on the level selected. | |
* | |
* 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 mypmpro_membership_checkout_image(){ | |
if( !empty( $_REQUEST['level'] ) ){ | |
$level = intval( $_REQUEST['level'] ); | |
if( $level == 1 ){ | |
$image_url = 'ADD FULL URL TO IMAGE HERE'; | |
} else if( $level == 2 ){ | |
$image_url = 'ADD DIFFERENT FULL URL TO IMAGE HERE HERE'; | |
} else { | |
$image_url = 'ADD DEFAULT URL TO IMAGE HERE'; | |
} | |
return "<div class='mypmpro_membership_checkout_image'><img src='$image_url' /></div>"; | |
} | |
} | |
add_shortcode( 'membership_checkout_image', 'mypmpro_membership_checkout_image' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment