Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /** START Add New Menu in Account Page from Woocommerce */
- /* Add Subscription and Unlocked Posts Endpoint for Account Page from Woocommerce */
- function subscription_and_unlocked_posts_new_endpoint() {
- add_rewrite_endpoint( 'subscription', EP_ROOT | EP_PAGES );
- add_rewrite_endpoint( 'unlocked-posts', EP_ROOT | EP_PAGES );
- }
- add_action( 'init', 'subscription_and_unlocked_posts_new_endpoint' );
- /* Create Subscription Content in Account Page from Woocommerce */
- function subscription_endpoint_content() {
- include JNEWS_PAYWALL_DIR . 'template/frontend-status-1.php';
- }
- add_action( 'woocommerce_account_subscription_endpoint', 'subscription_endpoint_content' );
- /* Create Unlocked Posts Content in Account Page from Woocommerce */
- function unlocked_posts_endpoint_content() {
- include JNEWS_PAYWALL_DIR . 'template/frontend-status-2.php';
- }
- add_action( 'woocommerce_account_unlocked-posts_endpoint', 'unlocked_posts_endpoint_content' );
- /* Add Menu Subscription and Unlocked Posts to Account Page from Woocommerce */
- function add_subscription_and_unlocked_posts_menu( $menu ) {
- $item = array(
- 'subscription' => esc_html__( 'Subscription', 'jnews-paywall' ),
- 'unlocked-posts' => esc_html__( 'Unlocked Posts', 'jnews-paywall' ),
- );
- $count = count( $menu );
- $menu = array_merge( array_slice( $menu, 0, $count - 1 ), $item, array_slice( $menu, $count - 1 ) );
- return $menu;
- }
- add_filter( 'woocommerce_account_menu_items', 'add_subscription_and_unlocked_posts_menu' );
- /** END Add New Menu in Account Page from Woocommerce */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement