Skip to content

Instantly share code, notes, and snippets.

@braginteractive
Created July 27, 2015 22:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save braginteractive/dc30b4951113767feb6b to your computer and use it in GitHub Desktop.
Save braginteractive/dc30b4951113767feb6b to your computer and use it in GitHub Desktop.
Show customizer panel just on Portfolio archive page
<?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