Viewing 1 replies (of 1 total)
  • Djules

    (@djules)

    Here is how I added my own list (in my case it was a list of languages).

    Either in file functions.php of your theme, or in another PHP file you’ll include in functions.php, add your own PHP class which implements Listo :

    class Listo_Languages implements Listo {
    
        private static $items = array(
            'af' => "Afrikaans",
            'ar' => "Arabic",
            'bg' => "Bulgarian",
        );
    
        private static $groups = array();
        private function __construct() {}
    
        public static function items() {
            return self::$items;
        }
    
        public static function groups() {
            return self::$groups;
        }
    
    }

    List your items in $items variable like I did (I deliberately shortened the list for the example), using pattern key => value.

    Then hook your new list to available lists in Listo.

    function add_my_own_listo_list( $list_types ) {
        $list_types['languages'] = 'Listo_Languages';
    
        return $list_types;
    }
    add_filter( 'listo_list_types', 'add_my_own_listo_list' );

    And you’re done ! Hopefully it helps.

Viewing 1 replies (of 1 total)
  • The topic ‘posible to have custom data’ is closed to new replies.