function wistiapress_settings_shortcodes_list() { $apiKey = get_option('wistiapress_api_key'); $wistiaApi = new WistiaApi($apiKey); $projects = $wistiaApi->projectList(); if (isset($projects->error)) { echo '<p><strong>Could not retrieve project list: ' . $projects->error . '</strong></p>'; return; } if (count($projects) > 0 && $projects !== null) { ?> <p>The following shortcodes can be used to list the videos in your Wistia projects:</p> <table style="width:100%;max-width:800px;border:1px solid black;border-collapse: collapse;" border="1"> <thead> <tr> <th>Project Name</th> <th># of Videos</th> <th>Shortcode</th> </tr> </thead> <tbody> <?php foreach ($projects as $project) { ?> <tr> <th style="text-align: center;"><?php echo esc_html($project->name); ?> </th> <td style="text-align: center;"><?php echo esc_html($project->mediaCount); ?> </td> <td style="text-align: center;">[wistiapress_media_list project="<?php echo $project->id; ?> "]</td> </tr> <?php } ?> </tbody> </table> <?php } }