Created
March 22, 2016 18:16
-
-
Save mikeyarce/4be5ee373996e863b984 to your computer and use it in GitHub Desktop.
Memberships Shortcode
This file contains hidden or 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
| /** | |
| * Creates a shortcode to output the "My Memberships" table anywhere on the site | |
| * Outputs this section only if the current user has 1 or more memberships | |
| * | |
| * Use the shortcode: [wcm_my_memberships] | |
| */ | |
| function sv_wc_memberships_my_memberships_shortcode() { | |
| // buffer contents | |
| ob_start(); | |
| ?><div class="woocommerce"><?php | |
| wc_memberships()->frontend->my_account_memberships(); | |
| ?></div><?php | |
| // output buffered content | |
| echo ob_get_clean(); | |
| } | |
| add_shortcode( 'wcm_my_memberships', 'sv_wc_memberships_my_memberships_shortcode' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment