Hi Michael,
I’m having some trouble styling the code you sent me.
There are basically two main errors that I can’t seem to fix.
1. One is the fact that I can’t get a space before the “Other Recent Posts”.
I’ve tried adding <p>, changing the <h2> style before to get soem padding before, inserting “\n” into the echo but with no avail. When I inspect the element in google chrome it seems that it’s considered one block with the list above.
2. Is that I’ve been trying to insert an ‘if..else’ in the code so that I can have an alternative sidebar for not non-category archive pages. However, I’m having syntax errors. I think it may have to do with the ?> right after it but I can’t figure out exactly what.
Perhaps you can help shed light on this?
thanks…
<div id="contentright">
<div class="title">
 </p>
<h1><a href="<?php echo get_option('home'); ?>/">Hofan is Home</a></li></h1>
<div id="sidebar">
</p>_____________________</p>
<?php
$used_ids = array();
if ( is_category() ) {
$current_cat_title = single_cat_title("", false);
$current_cat = get_query_var('cat');
$args=array(
'cat' => $current_cat,
'post_type' => 'post',
'post_status' => 'publish',
'posts_per_page' => -1,
'caller_get_posts'=> 1
);
$my_query = null;
$my_query = new WP_Query($args);
if( $my_query->have_posts() ) {
echo "<h2>$current_cat_title</h2>";
while ($my_query->have_posts()) : $my_query->the_post(); ?>
<div class="recentpostswrap"> <div class="recentpoststitle">
<a href="<?php the_permalink() ?>" rel="bookmark" title="Go to <?php the_title_attribute(); ?>"><?php the_title(); ?></a>
</div><li type=square></div>
<?php $used_ids[] = $my_query->post->ID;
endwhile;
}
$args=array(
'post__not_in' => $used_ids,
'post_type' => 'post',
'post_status' => 'publish',
'posts_per_page' => 99,
'caller_get_posts'=> 1
);
$my_query = null;
$my_query = new WP_Query($args);
if( $my_query->have_posts() ) {
echo'<h2>Other recent posts</h2>';
while ($my_query->have_posts()) : $my_query->the_post(); ?>
<div class="recentpostswrap"> <div class="recentpoststitle">
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a>
</div><li type=square></div>
<?php
endwhile;
}
wp_reset_query(); // Restore global post data stomped by the_post().
} // if (is_category()) else {
?></ul>
<div id="recentposts">
<h2>Recent Posts</h2>
<ul>
<?php query_posts('showposts=12'); ?>
<?php while (have_posts()) : the_post(); ?>
<div class="recentpostswrap">
<div class="recentpoststitle">
<a href="<?php the_permalink() ?>" rel="bookmark" title="<?php _e('Permanent link to'); ?> <?php the_title(); ?>"><?php the_title(); ?></a>
</div><li type=square>
</div>
<?php endwhile;?></ul>
</div>}
</p>
<a href="https://www.hofan.burntmango.org/journal/current/about/"><img src="https://www.hofan.burntmango.org/images/16.gif" align="right" height="150" border-style="none" title="About Hofan"/></a>
<div id="widgets">
<?php /* Widgetized sidebar, if you have the plugin installed. */
if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar() ) : ?>
<?php endif; ?>
</p>
</div>
<div id="searchformsidebar">
<?php include (TEMPLATEPATH . '/searchform.php'); ?>
</div>
</div>
</div>
here is an example of how it looks now, without the else:
https://www.hofan.burntmango.org/journal/current/category/writing/
(it won’t run with the else in there)