Creating template custom popup condition
-
Good day,
I’m trying to create a custom condition so that the popup will appear on all pages using the selected template following the examples on the “Add a custom popup condition”. I managed to get the existing theme templates to display in the Conditions box on the Edit Popup page but am unsure what the “callback” should be doing or what values I need to make available for the popup to work on the selected template page. Just looking for a little direction here.
Thanks
What I have so far is:
function pum_template_conditions( $conditions ) { return array_merge( $conditions, array( 'page_template_selected' => array( 'group' => __( 'Pages' ), 'name' => __( 'Has Template: Selected' ), 'callback' => '?????', 'fields' => array( 'selected' => array( 'placeholder' => __( 'Select Languages' ), 'type' => 'select', 'multiple' => true, 'select2' => true, 'as_array' => true, 'options' => pum_template_options(), ), ), ), ) ); }
and for the pum_template_options() I have:
function pum_template_options() { $get_themes= wp_get_theme()->get_page_templates(); foreach ($get_themes as $theme_path => $theme_name) { $theme[$theme_name] = $theme_path; } return $theme; }
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
- The topic ‘Creating template custom popup condition’ is closed to new replies.