Static Page and Inner page Work Great; break site a little
-
I decided to make some changes to my site by creating a static page and an inner page link that takes you to the primary blog. It is not that hard to do, but the results were unexpected.
This is what I did:
I made a copy of my themes index.php file and renamed it to Blog.php. I then turned it into a template by adding
<?php
/*
Template Name: Blog
*/
$pagenum = $wp_query->query_vars;
$pagenum = $pagenum['paged'];
if (empty($pagenum)) {
$pagenum = 1;
}
query_posts("posts_per_page=10&paged=$pagenum");
?>at the top of the page and saved it to my themes directory.
I then logged into my site and created a new page, naming it Blog, using ‘blog’ as a plug; and from the templates dropdown menu I selected Blog. OK, inner page made.
Next I created a Home page to serve as my static page.
I did this by making a copy of page.php in my theme. I then renamed it to home.php and added the following line of code
<?php query_posts('pagename=home'); ?>
right before the line that starts with<?php if (have_posts())…”
I then created another new page, named this one “Home” and giving it the plug ‘home’; then saved it.
Finally, I went into my header and located the portion of code that said
<div id="mainmenu">
<ul class="level1">
<li class="<?php echo $highlight; ?>"><a href="<?php echo get_settings('home'); ?>"><?php _e('Home','andreas09'); ?></a></li>I removed :
<li class="<?php echo $highlight; ?>"><a href="<?php echo get_settings('home'); ?>"><?php _e('Home','andreas09'); ?></a></li>
so that there would not be duplicate ‘Home’ buttons in my page menu.Then I viewed the page.
Perfect. Almost.
Here is where it gets strange. Two things happened:
First, my
<!--more-->
links were all broken. They were still there, but not a single one of them was working. The Blog page was displaying the entire posts in all of their verbosity. Odd.Next, the page buttons are designed to stay reddish once they have been selected and the site redirected to that current selected page. The notion is to let people know where they are.
The ‘Home” button behaves as expected when you click it. It turns red and stays red upon clicking it.
The Blog button does not. It stays Silver.
In other words, Home button assumes ‘current’ status, and Blog button won’t
Any guess as to why Blog button will not remain red?
Is more information needed? If so, let me know.
For the record, my funtions.php page controls the look and feel of the page menu buttons.
- The topic ‘Static Page and Inner page Work Great; break site a little’ is closed to new replies.