Reputation: 1802
I'm new to WordPress, I just converted my HTML to WP Theme, but now I'm facing a problem, I couldn't get to work the linking of pages.
The structure of my theme:
Here's the sample code from index.php:
<div id="menu">
<ul>
<li><a class="current" href="#">Home</a></li>
<li><a href="<?php bloginfo("template_url")?>/services.php">Services</a></li>
<li><a href="<?php bloginfo("template_url")?>/services.php#freequote">Free Quote</a></li>
<li><a href="<?php bloginfo("template_url")?>/customers.php">Customers</a></li>
<li><a href="<?php bloginfo("template_url")?>/about.php">About Us</a></li>
<li><a href="<?php bloginfo("template_url")?>/contact.php">Contact us</a></li>
</ul>
</div>
But whenever I try to go to services, it's giving internal server error. I don't know why it's happening.
Upvotes: 0
Views: 8913
Reputation: 3622
There are two ways in wordpress for linking Pages
For Content Based
pages only:
You need to create a page from wp-admin
(Admin panel) and can specify the slug of the page
E.g:
<li><a href="<?php bloginfo("template_url")?>/services">Services</a></li>
^This is called Slug
This page will always run from page.php
.
For HTML Changes
Pages:
You need to create a page from wp-admin
(Admin panel) and create a file containing
page-slug.php
, here slug will change according to the name of page.E.g:
Services
page will become page-services.php
, in this you can insert your own html
.
This will run from page-services
rather than page.php
Choose as per your requirement.
Upvotes: 2
Reputation: 610
Try using:
<a href="<?php echo bloginfo("template_url")?>/services.php">
I think in this case you are just not echoing out the value of that function. Also, however you might want this instead:
<a href="<?php echo home_url() ?>/services">
The template_url goes to your theme's folder, not to your website's homepage. I assume the latter is what you're really going for.
Upvotes: 1