linking to another page in wordpress

I apologize for the simplicity of this question. I am just beginning with wordpress and this issue has already wasted a lot of my time.

I have a login link in my homepage that I would like to redirect to another page login.php

Read More

the directory structure is ../themes/my-theme/

in the my-theme directory I am storing both home.php and login.php

Here is the html:

<a id="header-log-in" href="./wp-content/themes/my-theme/login.php">Log In</a>

Here is the code to login.php:

<?php
/**
 * Template Name: login
 * Description: login page
 * @package Backyard Cures
 */
?>

<?php get_header(); ?>
<?php wp_login_form(); ?>
<?php get_sidebar(); ?>
<?php wp_footer(); ?>

The problem is that for some reason when I click on the link none of the functions are recognized. I get the following error message:

Fatal error: Call to undefined function get_header()

Related posts

Leave a Reply

2 comments

  1. I would solve it by first creating a page in the admin panel, then selecting the template that you’ve created in the dropdown to the right.

    When you’ve done this you can simply link to it like this:

    <a id="header-log-in" href="<?php echo get_permalink( THE-ID-OF-YOUR-PAGE ); ?>">Log In</a>
    

    I prefer this approach because you get a nice overview of your pages in the admin panel, and they’re easily modified/changed using custom fields directly in the admin panel as opposed to having to edit the source code directly.