Dear folks , I've already created some website from scratch with html and javascript , php etc. On the other hand i also created websites with wordpress. I find the freedom in creating from scratch grandiose to say at least but wordpress to me has the benefits of professionally looking design from scratch which you dont need to code yourself and its ready made-ness.
Now i want to combine boths advantages and started a wordpress site with around 5 pages (menupoints) . Thing now is .... I want to add selfwritten files like the following php file which i've saved as testconnect.php as a webpage(menupoint). If possible i dont want to use a plugin , no i want to have the file as such saved somewhere in the wordpress directory and functioning. How do i do that ? Plenty of thx !!!

<!DOCTYPE  HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"  "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta  http-equiv="Content-Type" content="text/html;  charset=iso-8859-1"> <title>Search  Contacts</title> </head> <body> <h3>Search  Contacts Details</h3> <p>You  may search either by first or last name</p> <form  method="post" action="search.php?go"  id="searchform"> <input  type="text" name="name"> <input  type="submit" name="submit" value="Search"> </form> <?php
   if(isset($_POST['submit'])){
  if(isset($_GET['go'])){
  if(preg_match("/[A-Z  | a-z]+/", $_POST['name'])){
  $name=$_POST['name'];
  //connect  to the database
  $db=mysql_connect ("host",  "user", "pass") or die ('I cannot connect  to the database because: ' . mysql_error());
  else{
  echo  "<p>Please enter a search query</p>";
  }
  }
}
?> </body> </html> 

Recommended Answers

All 3 Replies

Wordpress is already built in with its own search function. Anyway, if one insist, there is some suggestion Click Here

The Wordpress templating engine allows full use of PHP, so you have the power (and responsability) of adding code like this.

There are effectively two ways to add this code to a page. You either edit or create a general template such as index.php or page.php. May themes use these to render the page content from the database.

Alternatively, you can define a template to use with only certain pages, which must be manually selected.

Either way, it sounds like your understanding of how Wordpress renders pages is a bit lacking. I really recommend you look at some of the developer material out there (there is a lot). Here's a good templating start point: https://developer.wordpress.org/themes/template-files-section/

Best of luck!

why don't you ask wordpress about it ?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.