• Hello,

    I’m designing a new theme for word press 1.5. With this new theme every category (blogroll, pages, etc) in the sidebar is shown in a separate block. The problem is that if there’s no pages in the pages category the block ‘pages’ is still shown on the sidebar and it looks not very good. I would like to fix it so if there’re some pages they are shown (with the block) and if there’s no pages the block is not shown. Can anybody help me with it?

Viewing 2 replies - 1 through 2 (of 2 total)
  • What code are you using to display the block currently?

    here some small hack. i dont know if its to suggest, but it works. maybe someone else has another idea.

    try this within your templates:

    <?php $pages = $wpdb->get_results("SELECT count(*) as numpages FROM $wpdb->posts WHERE post_status = 'static'", ARRAY_A);
    if($pages[0][numpages] >= 1) { ?>

    ... we have pages

    <?php } else { ?>

    ... we don't have pages

    <?php } ?>

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to hide/show pages block in the side bar?’ is closed to new replies.