How to Create a Custom Dynamic Page in WordPress

Custom dynamic pages in WordPress can be done with 2 types, which are mentioned below:

  • Online Live Cpanel
  • Offline XAMPP Server

Custom Dynamic Page in WordPress

Follow us to create custom dynamic pages in WordPress. Dynamic pages in WordPress are very useful, with the help of which we can create Dynamic Websites, we can also insert, delete, update and show the data of the database.

Here you will know how to create a dynamic page and how to fetch data from PHPMyAdmin, hope you will know by seeing this how to create the Dynamic Page.

Follow the steps to Create a Custom Dynamic Page in WordPress

Step1: Check your Active Theme

Open your WordPress Dashboard and go to Check your Activate Theme and Check your Activated Website Theme

Step2: Open PHPMyAdmin Page

Open the PhpMyAdmin page and check your Database name then open it and create a new table there

Create a new table named “reg“.

  `id` int(6) NOT NULL,
  `name` varchar(1000) NOT NULL,
  `pass` varchar(1000) NOT NULL,
  `address` varchar(1000) NOT NULL

INSERT INTO `reg` (`id`, `name`, `pass`, `address`) VALUES
(1, 'khushal', '123', 'naroda'),
(2, 'vishal', '258', 'hiravadi');

Step3: Open Sublime Editor

Open Sublime Editor and open the folder containing the code of your WordPress file.

Step4: Create a new Page named template-in.php File.

Open your theme folder and then check your active theme and there Create a new page named template-info.php file.

Step5: Write PHP Code and save it.

Open your template-into.php file and write PHP code and then save this file.

Note:- Here is written PHP’s MySQL query to show you a database from empty PHP MySQL, you can create other pages yourself.

//template name: info
// Enter your Host, username, password, database below.
// I left password empty because i do not set password on localhost.
$con=mysqli_connect('localhost','root','','newwebsite') or die("connection failed : ".mysqli_connect_error());

if ($con) {
	// echo "Connection Successfully";
	echo "Sorry Some Mistakes is";
// Check connection
if (mysqli_connect_errno())
  echo "Failed to connect to MySQL: " . mysqli_connect_error();

$sql ="select * from reg";
$data =mysqli_query($con,$sql);

if ($total=mysqli_num_rows($data)) {
	<table border="2">

	while ($result = mysqli_fetch_array($data)) {

		echo " 
 	echo "no record found";



Step6: Create a new Page

open WordPress Dashboard and click a Create a new page.

Step7: Select info Template

Give the title name information of the new page, and on the right side of the page, there will be a dropdown of the template inside the page attributes, select the new template that has been created named Info and publish that page.

Step8: Open your New Page

Open your new information page and check your output.


How to add Header and Footer in the new WordPress Dynamic page?

To add the Header and Footer to the new WordPress dynamic page, you need to enter the following code in your page.

// add this code in top side

// add this code in footer side

Related Posts

One thought on “How to Create a Custom Dynamic Page in WordPress

Leave a Reply

Your email address will not be published. Required fields are marked *