Created
July 27, 2015 22:32
-
-
Save braginteractive/dc30b4951113767feb6b to your computer and use it in GitHub Desktop.
Show customizer panel just on Portfolio archive page
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
<?php | |
function prefix_customizer_register( $wp_customize ) { | |
$wp_customize->add_panel( 'panel_id', array( | |
'priority' => 10, | |
'capability' => 'edit_theme_options', | |
'theme_supports' => '', | |
'title' => __( 'Example Panel', 'textdomain' ), | |
'description' => __( 'Description of what this panel does.', 'textdomain' ), | |
'active_callback' => 'callback_portfolio', | |
) ); | |
function callback_portfolio(){ | |
return is_post_type_archive( 'portfolio' );; | |
} | |
$wp_customize->add_section( 'section_id', array( | |
'priority' => 10, | |
'capability' => 'edit_theme_options', | |
'theme_supports' => '', | |
'title' => __( 'Example Section', 'textdomain' ), | |
'description' => '', | |
'panel' => 'panel_id', | |
) ); | |
$wp_customize->add_setting( 'textarea_field_id', array( | |
'default' => '', | |
'type' => 'theme_mod', | |
'capability' => 'edit_theme_options', | |
'transport' => '', | |
'sanitize_callback' => 'esc_textarea', | |
) ); | |
$wp_customize->add_control( 'textarea_field_id', array( | |
'type' => 'textarea', | |
'priority' => 10, | |
'section' => 'section_id', | |
'label' => __( 'Textarea Field', 'textdomain' ), | |
'description' => '', | |
) ); | |
} | |
add_action( 'customize_register', 'prefix_customizer_register' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment