What happens if you don’t use the Front template for the Home page?
In my ‘Front’ template I have used <?php the_content(); ?> to try and display the content.
Is that tag in a Loop? Without The_Loop it will not display anything.
What happens if you don’t use the Front template for the Home page?
I tried another tack. I decided to use a normal front page that used index.php. In index.php I used query_posts to pull up any posts categorised as ‘front’ (I know it seems long winded, but it gives quite a bit of flexibility).
Anyway, that’s fine, but now my sidebar conditional statements don’t work, i.e. if (is_home()) doesn’t pick up the home page.
Does query_posts somehow affect this?
Thanks,
Leon
This is the index.php code:
<?php query_posts('category_name=front') ?>
<?php while (have_posts()) : the_post(); ?>
<div id="banner">
<h2><?php the_excerpt(); ?>
</div>
<div id="content">
<h3><?php the_title(); ?></h3>
<?php the_content(); ?>
</div>
<?php endwhile; ?>
Works just fine, but when I call sidebar.php:
<?php
<?php if (is_home()) {
echo "<h2>Find out how we help companies</h2>";
echo "<ul class=\"linklist\">";
wp_get_archives('type=postbypost');
echo "";
echo "<h2>Latest thinking from the blog</h2>";
echo "<h3>How to do only that which you can do</h3>";
echo "<p>Blog excerpt. <a>Visit our blog</a>.</p>";
}
elseif (is_page('About')) {
echo "<h2>Contact us</h2>";
echo "<p>123 West St.SomewhereSomewhereTel: +1 111 123 4567email: x@mail.com</p>";
echo "<h2>What our clients say</h2>";
echo "<ul class=\"quotelist\">";
wp_list_bookmarks('title_li=&categorize=0&category_name=quote&limit=1&show_description=1');
echo "";
}
else {
echo "<h2>What our clients say</h2>";
echo "<ul class=\"quotelist\">";
wp_list_bookmarks('title_li=&categorize=0&category_name=quote&show_description=1');
echo "";
}
?>
No sidebar content is displayed, apart from the final else block (which means that the code doesn’t recognise the current page). I’m wondering whether my syntax is correct here (I’m new to PHP).