Created
June 11, 2022 23:37
-
-
Save daddiofaddio/02c9e131b746e695878c620d53ed6b34 to your computer and use it in GitHub Desktop.
Display Woocommerce Memberships shortcode (functions.php)
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
/* WOO MEMBERSHIPS TABLE SHORTCODE - WITH HEADER */ | |
function ploa_woo_memberships_shortcode() { | |
if (!function_exists('wc_memberships') || is_admin()) { | |
return; | |
} | |
ob_start(); | |
?> | |
<div class="woocommerce"> | |
<h2><?php esc_html_e('My Membership', 'textdomain'); ?></h2> | |
<?php | |
wc_get_template('myaccount/my-memberships.php', array( | |
'customer_memberships' => wc_memberships_get_user_memberships() , | |
'user_id' => get_current_user_id() , | |
)); | |
?> | |
</div> | |
<?php | |
return ob_get_clean(); | |
} | |
add_shortcode('woo-membership', 'ploa_woo_memberships_shortcode'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment