Created
February 24, 2017 09:26
-
-
Save ilicfilip/00ee52690ece5399e8105aec63706024 to your computer and use it in GitHub Desktop.
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
<?php | |
public function render_option_tabs( $requested_tabs, $post_type = 'default' ) { | |
$screen = get_current_screen(); | |
$tabs_names = array( | |
'sliders' => esc_html__( 'Sliders', 'Avada' ), | |
'page' => esc_html__( 'Page', 'Avada' ), | |
'post' => ( 'avada_faq' === $screen->post_type ) ? esc_html__( 'FAQ', 'Avada' ) : esc_html__( 'Post', 'Avada' ), | |
'header' => esc_html__( 'Header', 'Avada' ), | |
'footer' => esc_html__( 'Footer', 'Avada' ), | |
'sidebars' => esc_html__( 'Sidebars', 'Avada' ), | |
'background' => esc_html__( 'Background', 'Avada' ), | |
'pagetitlebar' => esc_html__( 'Page Title Bar', 'Avada' ), | |
'portfolio_post' => esc_html__( 'Portfolio', 'Avada' ), | |
'product' => esc_html__( 'Product', 'Avada' ), | |
); | |
$tabs = array( | |
'requested_tabs' => $requested_tabs, | |
'tabs_names' => $tabs_names, | |
'tabs_path' => array(), | |
); | |
$tabs = apply_filters( 'avada_metabox_tabs', $tabs, $post_type); | |
?> | |
<ul class="pyre_metabox_tabs"> | |
<?php foreach ( $tabs['requested_tabs'] as $key => $tab_name ) : ?> | |
<?php $class_active = ( 0 === $key ) ? 'active' : ''; ?> | |
<?php if ( 'page' == $tab_name && 'product' == $post_type ) : ?> | |
<li class="<?php echo esc_attr( $class_active ); ?>"><a href="<?php echo esc_attr( $tab_name ); ?>"><?php echo esc_attr( $tabs['tabs_names'][ $post_type ] ); ?></a></li> | |
<?php else : ?> | |
<li class="<?php echo esc_attr( $class_active ); ?>"><a href="<?php echo esc_attr( $tab_name ); ?>"><?php echo esc_attr( $tabs['tabs_names'][ $tab_name ] ); ?></a></li> | |
<?php endif; ?> | |
<?php endforeach; ?> | |
</ul> | |
<div class="pyre_metabox"> | |
<?php foreach ( $tabs['requested_tabs'] as $key => $tab_name ) : ?> | |
<div class="pyre_metabox_tab" id="pyre_tab_<?php echo esc_attr( $tab_name ); ?>"> | |
<?php | |
$path = !empty( $tabs['tabs_path'][$tab_name] ) | |
? $tabs['tabs_path'][$tab_name] | |
: dirname( __FILE__ ) . '/tabs/tab_' . $tab_name . '.php'; | |
require_once wp_normalize_path( $path ); | |
?> | |
</div> | |
<?php endforeach; ?> | |
</div> | |
<div class="clear"></div> | |
<?php | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment