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(preg_match("/[A-Z  | a-z]+/", $_POST['name'])){
  //connect  to the database
  $db=mysql_connect ("host",  "user", "pass") or die ('I cannot connect  to the database because: ' . mysql_error());
  echo  "<p>Please enter a search query</p>";
?> </body> </html> 

Edited by pritaeas: Removed credentials.

1 Year
Discussion Span
Last Post by jkon

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!

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.