apply_filters( 'learndash_binary_selector_args', array $args, string $selector_class )
Filters binary selector setting arguments.
Description #
Parameters #
- $args
-
(array) An Array of arguments used by the selector.
- $selector_class
-
(string) Class reference to selector.
Source #
File: includes/admin/class-learndash-admin-binary-selector.php
Examples #
Note: Extended code example below not guaranteed, you may need to consult with a developer
<?php /** * Example usage for learndash_binary_selector_args filter. */ add_filter( 'learndash_binary_selector_args', function( $args = array(), $selector_class = '' ) { // Example 1: change the search results number of items on the 'Learndash_Binary_Selector_Group_Courses' selector only if ( $selector_class == 'Learndash_Binary_Selector_Group_Courses' ) { // The 'search_number' $args element controls the number of items max to return during a search. By default // this will match the 'number' element which is based on the number of posts to show per page. $args['search_number'] = 100; } // Example 2: Change the height of all selectors. // There are two elements for the height, 'max_height' and 'min_height'. The default value for both of these is '250px'. // These are rendered into inline style elements. $args['min_height'] = $args['max_height'] = '450px'; // Example 3: Change the User Groups 'Learndash_Binary_Selector_User_Groups' selector post per page. if ( $selector_class == 'Learndash_Binary_Selector_User_Groups' ) { $args['posts_per_page'] = 10; } // always return the $args array return $args; }, 50, 2 ); add_filter( 'learndash_binary_selector_args', function( $args = array(), $selector_class = '' ) { $args['search_number'] = 100; return $args; }, 50, 2 ); add_filter( 'learndash_binary_selector_args', 'learndash_binary_selector_args_proc', 10, 2 ); function learndash_binary_selector_args_proc( $args, $selector_class ) { // Example to override the number of items per page. The default value is pulled from // the Settings > Reading > Posts per page value. $args['number'] = 20; $args['posts_per_page'] = 20; // Example changing only specific selectors if ( $selector_class == 'Learndash_Binary_Selector_Group_Courses' ) { // change the $args array items } // as this is a filter we are expected to return the $args array passed in to this function return $args; }
Changelog #
Version | Description |
---|---|
2.2.1 | Introduced. |