BTW, I also tried <?php permalink_single('posts.php'); ?> but I got a Fatal error: Call to undefined function: permalink_single() ...
BTW, I also tried <?php permalink_single('posts.php'); ?> but I got a Fatal error: Call to undefined function: permalink_single() ...
Are you trying to have 2 different templates, or just to change the name from index to posts.php?
Having done a 2-template site (with no comments, no permalinks, and no calendar), my advice is avoid if at all possible - it's a really ugly hack trying to get the permalinks, archives, and category links on both templates to point back to that same template instead of the other one.
I ended up modifying the get_permalink and get_month_link functions in wp-includes/template-functions-links.php and more..
Anyway, before I end up embarrassing myself with some butt-ugly and probably irrelevant code here, it might be helpful to tell us what you're trying to do.
I am trying to have two different templates. One for the front page (index.php) and one for viewing archived posts in a variety of ways (posts.php). I could get around this if I had a better understanding of the conditional controls available to me. But I'm a PHP newbie.
Sorry, what's "clean uri?"
Oh don't get me started. I've tried to create the nice URLs and I always get 404 errors. But in any case, this won't help me as they are all using the same template. I want different things on different types of pages.
I think I can also do what I want using conditionals to evaluate variables like $single but I don't know what all the variables I can use are. Is there one for $monthly? How about $front or something that indictaes if they're on the front/root page?
rubyji - have you set up your .htaccess file so you can use the clean URIs?
Yes I have added the code to my .htaccess file. And I have CHMODed it to a variety of things, although I think 644 is what it's supposed be (right?). Nothing works. It's not my top priority right now. Thanks, though.
rubyji - I have the same problem.
I found a solution here: http://wordpress.org/support/3/9484
But I'd like a solution without a patch.
What you want to do sounds similiar to how I have my site set up. I have seperated the standard index.php into header and footer files so that I can make 'static' pages.
(Keep in mind I have tags in these that are specific to my site)
Header.php:
<?php
/* Don't remove this line. */
require('./wp-blog-header.php');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head profile="http://gmpg.org/xfn/1">
<title><?php bloginfo('name'); ?><?php wp_title(); ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=<?php bloginfo('charset'); ?>" />
<meta name="generator" content="WordPress <?php bloginfo('version'); ?>" /> <!-- leave this for stats -->
<style type="text/css" media="screen">
@import url( <?php echo get_settings('siteurl'); ?>/wp-layout.css );
</style>
<link rel="stylesheet" type="text/css" media="print" href="<?php echo get_settings('siteurl'); ?>/print.css" />
<link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="<?php bloginfo('rss2_url'); ?>" />
<link rel="alternate" type="text/xml" title="RSS .92" href="<?php bloginfo('rss_url'); ?>" />
<link rel="alternate" type="application/atom+xml" title="Atom 0.3" href="<?php bloginfo('atom_url'); ?>" />
<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
<?php wp_get_archives('type=monthly&format=link'); ?>
<?php //comments_popup_script(); // off by default ?>
<?php wp_head(); ?>
</head>
<body>
<div id="rap">
<h1 id="header">"><?php bloginfo('name'); ?></h1>
<div id="content">
Footer.php:
</div>
<div id="menu">
<input type="submit" name="submit" value="<?php _e('Search'); ?>" />
</div>
</form>
<li id="archives"><?php _e('Archives:'); ?>
</div>
</div>
</body>
</html>
And then any page I want to create is only 3 lines of code:
Index.php:
<?php include('wp-includes/header.php') ?>
<?php include('wp-includes/posts.php') ?>
<?php include('wp-includes/footer.php') ?>
My resume and links page use this method.
You could create a new page: newpage.php
and have the code:
<?php include('wp-includes/header.php') ?>
<?php include('wp-includes/NEWTEMPLATE.php') ?>
<?php include('wp-includes/footer.php') ?>
If you want a completely different look for that page, just create a new header file and use a different CSS file for it.
<?php include('wp-includes/NEWHEADER.php') ?>
<?php include('wp-includes/NEWTEMPLATE.php') ?>
<?php include('wp-includes/footer.php') ?>
Create whatever CSS you want for NEWHEADER.php
This topic has been closed to new replies.