I am trying to create a page test.php
that can use wordpress
functions but is not part of the admin/pages
section. so basically if I have a link on my single.php
or page.php
to direct me to test.php
not show the 404
but actually show me the contents of test.php
. I've heard that i might have to make some changes to the htaccess
but I'm not sure how to search for this issue so any help is greatly appreciated.
Asked
Active
Viewed 86 times
1
-
test.php is your template file....? – Dinesh Jul 24 '14 at 04:24
-
it's actually a file not a template but it needs to use wordpress functions – Andres Jul 24 '14 at 04:25
-
you can achieve this by making test.php to template file...and can use wordpress functions... – Dinesh Jul 24 '14 at 04:31
-
ok but this will in no way be used by any pages in the admin..it's separate..it does it's own thing – Andres Jul 24 '14 at 04:32
-
Any custom plugin, `functions.php` in your theme, or file in `/wp-content/mu-plugins` will do this. – doublesharp Jul 24 '14 at 04:34
-
@doublesharp can u elaborate? I'm not sure I understand how. – Andres Jul 24 '14 at 04:35
-
The information for creating [page templates](http://codex.wordpress.org/Page_Templates), [plugins](http://codex.wordpress.org/Writing_a_Plugin) and using [functions.php](http://codex.wordpress.org/Functions_File_Explained) can all be found on the WordPress site. – doublesharp Jul 24 '14 at 04:42
2 Answers
1
You can use include('../wp-load.php');
in the top of your php file to get wordpress functionality in to your file then place your file in the root wordpress installation and then you can call your file with your url http://yourdomain.net/test.php
The information for creating page templates, plugins and using functions.php can all be found on the WordPress site.

Community
- 1
- 1

wordpresrox
- 590
- 11
- 31
0
if ( is_admin() ) {
add_action( 'admin_menu', array( 'adminAddPage' ) );
}
/**
* Callback to add page
*/
public function adminAddPage() {
add_options_page( 'Custom page title', 'Custom page title', 'manage_options', 'custom_page_slug', array('adminPage') );
}
/**
* Page HTML Callback
*/
public function adminPage() {
// your html code
}

Valerii Bodarev
- 1
- 1