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