| 1 |
<?php |
| 2 |
/** |
| 3 |
* Admin View: Displaying all LearnPress's related themes. |
| 4 |
* |
| 5 |
* @author ThimPress |
| 6 |
* @package LearnPress/Views |
| 7 |
* @version 3.0.0 |
| 8 |
*/ |
| 9 |
|
| 10 |
defined( 'ABSPATH' ) || exit(); |
| 11 |
|
| 12 |
// Thimpress Education themes |
| 13 |
$education_themes = LP_Plugins_Helper::get_related_themes( 'education' ); |
| 14 |
// Thimpress other themes |
| 15 |
$other_themes = LP_Plugins_Helper::get_related_themes( 'other' ); |
| 16 |
|
| 17 |
if ( ! ( $education_themes || $other_themes ) ) { |
| 18 |
_e( 'No related themes.', 'learnpress' ); |
| 19 |
return; |
| 20 |
} |
| 21 |
|
| 22 |
$all_themes = array( |
| 23 |
array( |
| 24 |
'title' => __( 'Education Support', 'learnpress' ), |
| 25 |
'items' => $education_themes, |
| 26 |
), |
| 27 |
array( |
| 28 |
'title' => __( 'Other', 'learnpress' ), |
| 29 |
'items' => $other_themes, |
| 30 |
), |
| 31 |
); |
| 32 |
|
| 33 |
$lp_query_items_bg = new LP_Background_Query_Items(); |
| 34 |
$lp_query_items_bg->query_related_themes(); |
| 35 |
|
| 36 |
foreach ( $all_themes as $themes ) { |
| 37 |
if ( $themes['items'] ) { |
| 38 |
?> |
| 39 |
<h2><?php echo sprintf( '%s (<span>%s</span>)', esc_html( $themes['title'] ), sizeof( $themes['items'] ) ); ?></h2> |
| 40 |
<ul class="addons-browse related-themes widefat"> |
| 41 |
<?php |
| 42 |
foreach ( $themes['items'] as $key => $item ) { |
| 43 |
$item['url'] = learn_press_get_item_referral( $item['id'] ); |
| 44 |
|
| 45 |
learn_press_admin_view( |
| 46 |
'addons/html-loop-theme', |
| 47 |
array( |
| 48 |
'theme' => $item, |
| 49 |
'ref' => '', |
| 50 |
) |
| 51 |
); |
| 52 |
} |
| 53 |
?> |
| 54 |
</ul> |
| 55 |
<?php |
| 56 |
} |
| 57 |
} |
| 58 |
|