Learndash_Helpers::all_ld_groups( string $label = null, string $option_code = 'LDGROUP', $all_label = false, $any_option = true )
Contents
Parameters Parameters
- $label
-
(string) (Optional)
Default value: null
- $option_code
-
(string) (Optional)
Default value: 'LDGROUP'
Return Return
(mixed)
Source Source
File: src/integrations/learndash/helpers/learndash-helpers.php
public function all_ld_groups( $label = null, $option_code = 'LDGROUP', $all_label = false, $any_option = true ) { if ( ! $this->load_options ) { return Automator()->helpers->recipe->build_default_options_array( $label, $option_code ); } if ( ! $label ) { $label = esc_attr__( 'Group', 'uncanny-automator' ); } $args = [ 'post_type' => 'groups', 'posts_per_page' => 9999, 'orderby' => 'title', 'order' => 'ASC', 'post_status' => 'publish', ]; if ( $all_label ) { $options = Automator()->helpers->recipe->options->wp_query( $args, $any_option, esc_attr__( 'Any group', 'uncanny-automator' ), $all_label ); } else { $options = Automator()->helpers->recipe->options->wp_query( $args, $any_option, esc_attr__( 'Any group', 'uncanny-automator' ) ); } $option = [ 'option_code' => $option_code, 'label' => $label, 'input_type' => 'select', 'required' => true, 'options' => $options, 'relevant_tokens' => [ $option_code => esc_attr__( 'Group title', 'uncanny-automator' ), $option_code . '_ID' => esc_attr__( 'Group ID', 'uncanny-automator' ), $option_code . '_URL' => esc_attr__( 'Group URL', 'uncanny-automator' ), ], 'custom_value_description' => _x( 'Group ID', 'LearnDash', 'uncanny-automator' ), ]; return apply_filters( 'uap_option_all_ld_groups', $option ); }
Expand full source code Collapse full source code View on Github