tutor_pages.php
90 lines
| 1 | <?php |
| 2 | $tutor_pages = tutils()->tutor_pages(); |
| 3 | ?> |
| 4 | |
| 5 | <div id="tools-tutor-pages" class="tools-tutor-pages"> |
| 6 | |
| 7 | <table class="tutor-table tutor-pages-table"> |
| 8 | |
| 9 | <thead> |
| 10 | <tr> |
| 11 | <th><?php _e('ID', 'tutor'); ?></th> |
| 12 | <th><?php _e('Page Name', 'tutor'); ?></th> |
| 13 | <th><?php _e('Status', 'tutor'); ?></th> |
| 14 | |
| 15 | </tr> |
| 16 | </thead> |
| 17 | |
| 18 | <tbody> |
| 19 | |
| 20 | <?php |
| 21 | foreach ($tutor_pages as $page){ |
| 22 | $page_id = $page['page_id']; |
| 23 | ?> |
| 24 | <tr> |
| 25 | <td><?php echo $page_id; ?></td> |
| 26 | <td> |
| 27 | <?php |
| 28 | echo "<p>"; |
| 29 | |
| 30 | if ($page['page_exists']){ |
| 31 | $edit_url = admin_url("post.php?post={$page_id}&action=edit"); |
| 32 | echo "<a href='{$edit_url}' target='_blank'>"; |
| 33 | } |
| 34 | echo $page['page_name']; |
| 35 | |
| 36 | if ($page['page_exists']){ |
| 37 | echo '</a>'; |
| 38 | } |
| 39 | echo "</p>"; |
| 40 | ?> |
| 41 | </td> |
| 42 | |
| 43 | <td> |
| 44 | <?php |
| 45 | if ( ! $page_id ){ |
| 46 | echo '<p style="color: red;">'; |
| 47 | echo "<i class='dashicons dashicons-warning'></i> "; _e(' Page not set', 'tutor'); |
| 48 | echo '</p>'; |
| 49 | } |
| 50 | |
| 51 | if ( ! $page['page_exists'] ){ |
| 52 | echo '<p style="color: red;">'; |
| 53 | echo "<i class='dashicons dashicons-warning'></i> "; _e(' Page deleted, please set new one', 'tutor'); |
| 54 | echo '</p>'; |
| 55 | } |
| 56 | |
| 57 | if ($page['page_exists'] && ! $page['page_visible']){ |
| 58 | echo '<p style="color: red;">'; |
| 59 | echo "<i class='dashicons dashicons-warning'></i> "; _e('Page visibility is not public', 'tutor'); |
| 60 | echo '</p>'; |
| 61 | } |
| 62 | |
| 63 | if ($page['page_exists'] && $page['page_visible']){ |
| 64 | $page = get_post($page_id); |
| 65 | |
| 66 | echo "<a href='".get_permalink($page)."' target='_blank' style='color: green;'> <i class='dashicons dashicons-yes-alt'></i> /{$page->post_name} </a>"; |
| 67 | } |
| 68 | ?> |
| 69 | </td> |
| 70 | </tr> |
| 71 | <?php |
| 72 | } |
| 73 | ?> |
| 74 | </tbody> |
| 75 | </table> |
| 76 | |
| 77 | <form action="" method="post"> |
| 78 | <?php |
| 79 | tutor_action_field('regenerate_tutor_pages'); |
| 80 | tutor_nonce_field(); ?> |
| 81 | |
| 82 | <p> |
| 83 | <button class="tutor-button tutor-button-primary" type="submit"><?php _e('Re-Generate Tutor Pages','tutor'); ?></button> |
| 84 | </p> |
| 85 | </form> |
| 86 | |
| 87 | <?php |
| 88 | tutor_alert(__('Note: This tool will install all the missing Tutor pages. Pages already defined and set up will not be replaced.', 'tutor'), 'info'); |
| 89 | ?> |
| 90 | </div> |