how to add a custom php file to wordpress
-
What Im trying to do is get WordPress to run a custom php file but when ever I have to load this file called test.php it crashes when it gets and loads up any of the functions.. I cant figure out what I’m doing wrong… it seams like I’m missing some include file but I dont know what it is..
and what would be the best way to have WordPress link to the file.. I’m trying to have it in the nav-menu as a link but don’t know if it will load all of the functions from WordPress like the db functions (like SELECT,UPDATE,INSERT).. Im going to make a Child Theme I dont know if that would help me with the php file
Its probably something simple I’m missing
<?php get_header(); ?> <?php if(!is_user_logged_in()){ header("Location: index.php"); die("Redirecting to index.php"); }else { global $current_user; get_currentuserinfo(); echo 'Username: ' . $current_user->user_login . "\n"; echo 'User email: ' . $current_user->user_email . "\n"; echo 'User first name: ' . $current_user->user_firstname . "\n"; echo 'User last name: ' . $current_user->user_lastname . "\n"; echo 'User display name: ' . $current_user->display_name . "\n"; echo 'User ID: ' . $current_user->ID . "\n"; } echo "other things to be ran in the php script"; ?> <?php get_sidebar(); ?> <?php get_footer(); ?>
The topic ‘how to add a custom php file to wordpress’ is closed to new replies.