Forums

query_posts and conditional tag tests? (2 posts)

  1. Danny21K
    Member
    Posted 2 years ago #

    I'm having trouble getting a conditional test to work as it should, i've included the part of the code that seems to be relevant bellow, if the 'Category_Cloud_Mini' function was not there then the conditional test works, if the function is in the page before the test then every page tests as the 'home' page, including single & category pages,

    assuming that it's the 'query_posts' thing that's causing the problem, i'd be grateful if anyone could tell me why its causing the conditional test to go wrong?

    thanks for any help with this,

    function Category_Cloud_Mini() {
                foreach((query_posts('showposts=25')) as $post) {
                }
            }
            Category_Cloud_Mini();

    followed by:

    if (is_home()) {
                echo "ON HOME PAGE";
            }
            elseif (is_single()) {
                echo "ON SINGLE PAGE";
            }
            elseif (is_category()) {
                echo "ON CATEGORY PAGE";
            }
  2. zackkline
    Member
    Posted 2 years ago #

    I was trying to do something similar...list pages in the sidebar and query post seemed to mess it up too. In fact, in looking for the solution, I came across your post, so I'll let you know if I find out how to fix it.

Topic Closed

This topic has been closed to new replies.

About this Topic