Home / Archive / MemberPress: Move “Upgrade” Button to after Subscriptions Tab
Duplicate Snippet

Embed Snippet on Your Site

MemberPress: Move “Upgrade” Button to after Subscriptions Tab

This code snippet creates a new tab positioned right after the Subscriptions tab on the MemberPress account page and moves the first Upgrade button to that new tab.

Code Preview
php
<?php
add_action('wp_footer', function() {
	?>
	<script>
		(function($) {
			$(document).ready(function() {
				// First upgrade button
				var upgrade = $('.mepr-account-upgrade').first();
				// Subscriptions tab
				var subscriptions = $('.mepr-subscriptions');
				if ( upgrade.length && subscriptions.length ) {
					// Create a new tab after the subscriptions tab and move the upgrade button into it
					subscriptions.after( '<span class="mepr-nav-item new-upgrade-tab"></span>' );
					$('.new-upgrade-tab').append( upgrade );
				}
			});
		})(jQuery);
	</script>
	<?php
});

Comments

Add a Comment