PUM_Upsell::display_addon_tabs()
Displays the tabs for ‘Popups’, ‘Popup Themes’ and ‘Extensions and Integrations’
Description Description
Source Source
File: classes/Upsell.php
public static function display_addon_tabs() { $popup_labels = PUM_Types::post_type_labels( __( 'Popup', 'popup-maker' ), __( 'Popups', 'popup-maker' ) ); $theme_labels = PUM_Types::post_type_labels( __( 'Popup Theme', 'popup-maker' ), __( 'Popup Themes', 'popup-maker' ) ); ?> <style> .wrap h1.wp-heading-inline + a.page-title-action { display: none; } .edit-php.post-type-popup .wrap .nav-tab-wrapper .page-title-action, .edit-php.post-type-popup_theme .wrap .nav-tab-wrapper .page-title-action, .popup_page_pum-extensions .wrap .nav-tab-wrapper .page-title-action { top: 7px; margin-left: 5px } @media only screen and (min-width: 0px) and (max-width: 783px) { .edit-php.post-type-popup .wrap .nav-tab-wrapper .page-title-action, .edit-php.post-type-popup_theme .wrap .nav-tab-wrapper .page-title-action, .popup_page_pum-extensions .wrap .nav-tab-wrapper .page-title-action { display: none !important } } </style> <nav class="nav-tab-wrapper"> <?php $tabs = array( 'popups' => array( 'name' => esc_html( $popup_labels['name'] ), 'url' => admin_url( 'edit.php?post_type=popup' ), ), 'themes' => array( 'name' => esc_html( $theme_labels['name'] ), 'url' => admin_url( 'edit.php?post_type=popup_theme' ), ), 'integrations' => array( 'name' => esc_html__( 'Upgrade', 'popup-maker' ), 'url' => admin_url( 'edit.php?post_type=popup&page=pum-extensions&view=integrations' ), ), ); $tabs = apply_filters( 'pum_add_ons_tabs', $tabs ); $active_tab = false; // Calculate which tab is currently active. if ( isset( $_GET['page'] ) && $_GET['page'] === 'pum-extensions' ) { $active_tab = 'integrations'; } elseif ( ! isset( $_GET['page'] ) && isset( $_GET['post_type'] ) ) { switch ( $_GET['post_type'] ) { case 'popup': $active_tab = 'popups'; break; case 'popup_theme': $active_tab = 'themes'; break; } } // Add each tab, marking the current one as active. foreach ( $tabs as $tab_id => $tab ) { $active = $active_tab === $tab_id ? ' nav-tab-active' : ''; ?> <a href="<?php echo esc_url( $tab['url'] ); ?>" class="nav-tab<?php echo esc_attr( $active ); ?>"> <?php echo $tab['name']; ?> </a> <?php } ?> <a href="<?php echo esc_url( admin_url( 'post-new.php?post_type=popup' ) ); ?>" class="page-title-action"> <?php echo esc_html( $popup_labels['add_new_item'] ); ?> </a> <a href="<?php echo esc_url( admin_url( 'post-new.php?post_type=popup_theme' ) ); ?>" class="page-title-action"> <?php echo esc_html( $theme_labels['add_new_item'] ); ?> </a> </nav> <?php }
Expand full source code Collapse full source code View on Trac
Changelog Changelog
Version | Description |
---|---|
1.8.0 | Introduced. |