Content in the Sidebar on Pages only?
-
Hi everyone,
I have set up a site with multiple pages and the blog section is set to a specific internal page as a news section.
What I am trying to do is have a snippet of the first news blog post appearing on the sidebar in every page on the site except the internal blog page.
I think I need some kind of if/else statement but not sure of the tags I need to use:
Have tried:
<?php if (is_blog()) { ?>
<p>Test</p>
<?php } else { ?>
<?php require('wp-blog-header.php');
query_posts('showposts=1');
while (have_posts()) : the_post(); ?>
<h2><?php the_title(); ?></h2>
<?php the_excerpt('…'); ?>
<?php endwhile; ?>
<?php } ?>
But no joy with this.
Can anyone help?
- The topic ‘Content in the Sidebar on Pages only?’ is closed to new replies.