plugin-admin-display.php
110 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Provide a admin area view for the plugin |
| 4 | * |
| 5 | * This file is used to markup the admin-facing aspects of the plugin. |
| 6 | * |
| 7 | * @since 2.0.0 |
| 8 | * @package Wp_Create_Multi_Posts_Pages |
| 9 | * @subpackage Wp_Create_Multi_Posts_Pages/admin/views |
| 10 | * @author Sajjad Hossain Sagor <sagorh672@gmail.com> |
| 11 | */ |
| 12 | |
| 13 | // If this file is called directly, abort. |
| 14 | if ( ! defined( 'ABSPATH' ) ) { |
| 15 | die; |
| 16 | } |
| 17 | |
| 18 | ?> |
| 19 | |
| 20 | <div class="wrap"> |
| 21 | <h2><?php echo esc_html__( 'Create Multiple Posts', 'wp-create-multiple-posts-pages' ); ?></h2> |
| 22 | <?php if ( isset( $wpcmp_show_message ) ) : ?> |
| 23 | <div class="notice notice-<?php echo esc_attr( $wpcmp_show_message ); ?> is-dismissible"> |
| 24 | <p><?php echo esc_html( $wpcmp_message ); ?></p> |
| 25 | </div> |
| 26 | <?php if ( 'success' === $wpcmp_show_message ) : ?> |
| 27 | <div class="notice notice-success is-dismissible wpcmp_notice"> |
| 28 | <h4><?php echo esc_html__( 'Created Posts', 'wp-create-multiple-posts-pages' ); ?>:</h4> |
| 29 | <div class="container-fluid"> |
| 30 | <?php foreach ( $created_posts as $wpcmp_id ) : ?> |
| 31 | <div class="row wpcmp_row"> |
| 32 | <p class="col-md-11 wpcmp_col_11"><?php echo esc_html( get_the_title( $wpcmp_id ) ); ?></p> |
| 33 | <p class="col-md-1 wpcmp_col_1"> |
| 34 | <a href="<?php echo esc_url( get_the_permalink( $wpcmp_id ) ); ?>" class='button wpcmp_a'> |
| 35 | <?php echo esc_html__( 'View', 'wp-create-multiple-posts-pages' ); ?> |
| 36 | </a> |
| 37 | <a href="<?php echo esc_url( get_edit_post_link( $wpcmp_id ) ); ?>" class='button'> |
| 38 | <?php echo esc_html__( 'Edit', 'wp-create-multiple-posts-pages' ); ?> |
| 39 | </a> |
| 40 | </p> |
| 41 | </div> |
| 42 | <?php endforeach; ?> |
| 43 | </div> |
| 44 | </div> |
| 45 | <?php endif; ?> |
| 46 | <?php endif; ?> |
| 47 | <form action="" method="post"> |
| 48 | <div class="form-group"> |
| 49 | <p class="col-form-label insert_note"> |
| 50 | <?php echo esc_html__( 'Insert Posts Title One Per Line', 'wp-create-multiple-posts-pages' ); ?> |
| 51 | <small> (<?php echo esc_html__( 'Press Enter To Go To A New Line', 'wp-create-multiple-posts-pages' ); ?>)</small> |
| 52 | </p> |
| 53 | <textarea class="form-control new_line_bg new_line_number" name="wpcmp_posts_titles" id="wpcmp_posts_titles" cols="30" rows="8"></textarea> |
| 54 | </div> |
| 55 | <div class="form-group"> |
| 56 | <div class="row"> |
| 57 | <div class="col"> |
| 58 | <p class="col-form-label insert_note"><?php echo esc_html__( 'Post Type', 'wp-create-multiple-posts-pages' ); ?></p> |
| 59 | <select name="wpcmp_new_post_type" id="wpcmp_new_post_type" class="form-control" disabled> |
| 60 | <?php foreach ( $post_types as $wpcmp_post_type ) : ?> |
| 61 | <option value="<?php echo esc_attr( $wpcmp_post_type ); ?>"><?php echo esc_html( ucfirst( $wpcmp_post_type ) ); ?></option> |
| 62 | <?php endforeach ?> |
| 63 | </select> |
| 64 | </div> |
| 65 | <div class="col"> |
| 66 | <p class="col-form-label insert_note"><?php echo esc_html__( 'Post Status', 'wp-create-multiple-posts-pages' ); ?></p> |
| 67 | <select name="wpcmp_new_post_status" id="wpcmp_new_post_status" class="form-control" disabled> |
| 68 | <option value="publish"><?php echo esc_html__( 'Publish', 'wp-create-multiple-posts-pages' ); ?></option> |
| 69 | <option value="draft"><?php echo esc_html__( 'Draft', 'wp-create-multiple-posts-pages' ); ?></option> |
| 70 | <option value="pending"><?php echo esc_html__( 'Pending', 'wp-create-multiple-posts-pages' ); ?></option> |
| 71 | <option value="private"><?php echo esc_html__( 'Private', 'wp-create-multiple-posts-pages' ); ?></option> |
| 72 | </select> |
| 73 | </div> |
| 74 | <div class="col"> |
| 75 | <p class="col-form-label insert_note"><?php echo esc_html__( 'Post Author', 'wp-create-multiple-posts-pages' ); ?></p> |
| 76 | <select name="wpcmp_new_post_author" id="wpcmp_new_post_author" class="form-control" disabled> |
| 77 | <?php |
| 78 | foreach ( $users as $user ) { |
| 79 | echo '<option value="' . esc_attr( $user->ID ) . '">' . esc_html( ucwords( str_replace( '_', ' ', $user->user_login ) ) ) . '</option>'; |
| 80 | } |
| 81 | ?> |
| 82 | </select> |
| 83 | </div> |
| 84 | <div class="col"> |
| 85 | <p class="col-form-label insert_note"><?php echo esc_html__( 'Post Category', 'wp-create-multiple-posts-pages' ); ?> <small><?php echo esc_html__( '(Posts Only)', 'wp-create-multiple-posts-pages' ); ?></small></p> |
| 86 | <select name="wpcmp_new_post_category[]" id="wpcmp_new_post_category" class="form-control" multiple disabled> |
| 87 | <?php |
| 88 | $categories = get_categories( |
| 89 | array( |
| 90 | 'orderby' => 'name', |
| 91 | 'order' => 'ASC', |
| 92 | 'hide_empty' => false, |
| 93 | ) |
| 94 | ); |
| 95 | |
| 96 | foreach ( $categories as $category ) { |
| 97 | echo '<option value="' . esc_attr( $category->term_id ) . '">' . esc_html( ucwords( str_replace( '_', ' ', $category->cat_name ) ) ) . '</option>'; |
| 98 | } |
| 99 | ?> |
| 100 | </select> |
| 101 | </div> |
| 102 | <div class="col"> |
| 103 | <p class="col-form-label insert_note"><?php echo esc_html__( 'Action', 'wp-create-multiple-posts-pages' ); ?></p> |
| 104 | <button type="submit" class="button" name="wpcmp_submit_for_create_posts" id="wpcmp_submit_for_create_posts" disabled><?php echo esc_html__( 'Add Posts', 'wp-create-multiple-posts-pages' ); ?></button> |
| 105 | </div> |
| 106 | </div> |
| 107 | <?php wp_nonce_field( 'wpcmp_create_posts', 'wpcmp_nonce' ); ?> |
| 108 | </div> |
| 109 | </form> |
| 110 | </div> |