Support » Fixing WordPress » Show Asides in the main content (single page)

  • Resolved dl33


    Hi all,
    I just updated my blog to show asides in the sidebar. (with the help of this forum)
    I put the following code in my sidebar:

    $asides = get_posts('category=14');
    if($asides) : foreach($asides as $post) : setup_postdata($post);
    <div class="asides_sidebar">
    <?php echo wptexturize($post->post_content); ?>
    <small><?php comments_popup_link(__('[0]'), __('[1]'), __('[%]')); ?><?php edit_post_link('Edit', ' — '); ?></small>
    <?php endforeach; else: ?>
    <div class="asides_sidebar">
    Sorry, no Asides.
    <?php endif; ?>

    (along with some other code in the loop and the sidebar as instructed on
    The problem that I have now, that the asides do not show on a single page. The content is not there, since the loop is beeing told to ignore my asides category. (This is only really a problem, since I am using the same loop file for all pages, but I would like to find a neat solution.)
    I have this line before my loop:
    <?php if (!(in_category('6')) ) { ?>
    How do I have to change it in order to make the asides show in the single pages, but not in all others? (At the moment they are not showing anywhere…)

Viewing 1 replies (of 1 total)
  • Save your index.php file as home.php. Then remove the conditional in index.php. WP looks for templates in a hierachy.
    So on the main page, the asides would be hidden, all others they would show up.

    For more info on templates and the hierarchy see the codex page Templates

Viewing 1 replies (of 1 total)
  • The topic ‘Show Asides in the main content (single page)’ is closed to new replies.