Advertisement
Guest User

wordpress custom php page

a guest
Oct 25th, 2015
767
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.31 KB | None | 0 0
  1.         <?php
  2.         // If title is not displayed before loading the header, Wordpress displays "Page not found" as the title
  3.        
  4.         echo "<head>
  5.         <title>I test somthing</title>
  6.         </head>";
  7.         // Wordpress path (if wordpress is not located at ROOT//
  8.         $wplocalpath="/Wordpress1";
  9.         // Include the Main Wordpress blog header
  10.         include $_SERVER['DOCUMENT_ROOT'].$wplocalpath."/wp-blog-header.php";
  11.        
  12.         //Now, you need to get the active theme's folder, and get a relative path to that folder
  13.        
  14.         $homeurl=home_url();
  15.         $ddir= get_bloginfo( 'template_directory');
  16.         $current_theme_relative_path=substr_replace($ddir, "", 0, strlen($homeurl));
  17.         //echo "<br/>The relative path to the currently active theme is ".$current_theme_relative_path;
  18.        
  19.         //Once you have the path, include the header and footer, adding your custom php code in between.
  20.         // Include the specific theme header you need
  21.        
  22.         include $_SERVER['DOCUMENT_ROOT'].$wplocalpath.$current_theme_relative_path."/header.php";
  23.        
  24.         // Your custom PHP code STARTS here
  25.        
  26.         // Add anything you want to display to the user
  27.         echo "
  28.         <h2>
  29.         Your form has been submitted
  30.         </h2>";
  31.        
  32.         // END of custom code
  33.        
  34.        
  35.        
  36.        
  37.         // Now end with the theme's footer
  38.         include $_SERVER['DOCUMENT_ROOT'].$wplocalpath.$current_theme_relative_path."/footer.php";
  39.        
  40.         ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement