简体   繁体   中英

Opening Custom Page URL in Wordpress

I can't seem to get a simple additional page opened in Wordpress. I have in my theme directory a file called contact.php . How do I get tag to source this page? Ideally it'd look similar to the below:

<a href="<?php get_template_directory_uri('contact'); ?>"> Contact Us </a>

If i were to use Wordpress's Page setup I'd have a huge block of code similar to:

if (page == contact) {
    return contact form
} elseif (page == about) {
    return about me page
} else {
    return the regular page format.
}

而是执行以下操作:

<a href="<?php echo get_template_directory_uri() . '/contact.php'; ?>"> Contact Us </a>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM