LLMS_Admin_AddOns::get_product_from_cat( string $cat, array $excludes )
Get a random product from a category that doesn’t exist in the list of excluded product ids
Parameters Parameters
- $cat
-
(string) (Required) category slug
- $excludes
-
(array) (Required) list of product ids to exclude
Return Return
(array|false)
Source Source
File: includes/admin/class.llms.admin.addons.php
public function get_product_from_cat( $cat, $excludes ) { $addons = $this->get_products_for_cat( $cat, true ); shuffle( $addons ); foreach ( $addons as $addon ) { if ( in_array( 'third-party', array_keys( $addon['categories'] ) ) ) { continue; } if ( ! in_array( $addon['id'], $excludes ) ) { return $addon; } } return false; }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
3.22.0 | Introduced. |