Created
July 18, 2016 18:14
-
-
Save slushman/c468381070f431d837afbf5af7e09247 to your computer and use it in GitHub Desktop.
WordPress Customizer select control with published Formidable forms.
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
$forms = FrmForm::get_published_forms(); | |
$choices = array(); | |
foreach ( $forms as $form ) { | |
$choices[$form->id] = $form->name; | |
} | |
// Formidable Forms Select Field | |
$wp_customize->add_setting( | |
'formidable_form_select', | |
array( | |
'capability' => 'edit_theme_options', | |
'default' => '', | |
'transport' => 'postMessage', | |
'type' => 'theme_mod' | |
) | |
); | |
$wp_customize->add_control( | |
'formidable_form_select', | |
array( | |
'active_callback' => '', | |
'choices' => $choices, | |
'description' => esc_html__( '', 'text-domain' ), | |
'label' => esc_html__( 'Formidable Forms Select', 'text-domain' ), | |
'priority' => 10, | |
'section' => 'your-section', | |
'settings' => 'formidable_form_select', | |
'type' => 'select' | |
) | |
); | |
$wp_customize->get_setting( 'formidable_form_select' )->transport = 'postMessage'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment