Skip to content

Instantly share code, notes, and snippets.

@megmorsie
Created December 17, 2015 15:51
Show Gist options
  • Save megmorsie/26146e2fa81ffd56011c to your computer and use it in GitHub Desktop.
Save megmorsie/26146e2fa81ffd56011c to your computer and use it in GitHub Desktop.
WordPress Stack Exchange: Customiser sections not being displayed with `active_callback`
<?php
/*
* Plugin Name: Stack: Customiser sections not being displayed with `active_callback`
* Plugin URI: http://wordpress.stackexchange.com/questions/211164/customiser-sections-not-being-displayed-with-active-callback
* Description: Stack Exchange - WordPress Development
* Version: 1.0
* Author: Megan Morsie
* Author URI: http://megabyterose.com/
* License: GPL2
*/
/* START - Original */
$wp_customise->add_section('section_template_single' , array(
'title' => __('Single Links', $this->text_domain),
'priority' => 10,
'panel' => 'panel_templates',
// 'active_callback' => 'is_single'
'active_callback' => 'callback_single' // * Changed
));
/* END - Original */
/* Added this function. */
function callback_single() { return is_single(); }
?>
@megmorsie
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment