Friday, December 6, 2019

Create custom wordpress plugin

<?php
/**
 * Plugin Name: Package Order List
 * Description: Plugin is creating for display the package order list.
 * Version: 1.0
 * Author: Pardeep kumar
 */
 error_reporting(0);
 function wps_poll_options_page_15() { //Change the 5 with any number as well as replace other 5's which are in this code
    ?>
<style>

   .heading_cls{ background: #898989;
    color: #fff;
    font-size: 13px;
    font-weight: bold;
    text-align: center;}

</style>
<div class="wrap">
<h2 style="text-align: center;padding: 10px;background: cornflowerblue;color: #fff;">Master Table </h2><br>   
<table width="80%" border="1" cellpadding="5" cellspacing="1">
<tr>                     
    <td class="heading_cls">Order Id</td>
        >
          </tr>
<?php
$servername = "localhost";
$username = "dajzrjyb_boxez";
$password = "FGHJ1aa2(*()";
$dbname = "dajzrjyb_ezboxes";

// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}

$sql_package = "SELECT * FROM wp_cbg7ccqh4q_package_order where order_status=1";
$result = $conn->query($sql_package);

if ($result->num_rows > 0) {
    while($row_pack = $result->fetch_assoc()) {
?>

<tr>
    <td><?php echo $row_pack["order_id"]; ?></td>
   
         </tr>
<?php
    }
} else {
    echo "0 results";
}
?>
</table>

</div>
<?php
}
function wps_poll_menu_15 () {
add_menu_page('All Package Order','All Package Order','manage_options','wps_poll_admin_15', 'wps_poll_options_page_15');
}
add_action('admin_menu','wps_poll_menu_15');
?>

2 comments:

  1. amazing content, thanks for this

    ReplyDelete
  2. Thank you very much for sharing this informative write-up. There is very much to learn from the blog. This is really very useful.

    ReplyDelete