Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter tadramgo

    (@tadramgo)

    Okay, so I’ve done some more hours and hours of digging to find something likely to work:

    <?php

    $query = “pagename=”;
    $query .= $page_slug;

    $pageArray = query_posts($query); //retrieves the about $query page only
    setup_postdata($pageArray);
    $PageID = $pageArray[0]->ID;
    echo $about_PageID;

    ?>

    This seems fine to me, basically I should end up with the page ID, from which I can grab any content I want. Or indeed I could grab the content straight out of pageArray.

    However when this is placed within The Loop it produces a infinite loop. Which is a bummer.

    Any insights?

    Tom

    Thread Starter tadramgo

    (@tadramgo)

    Globals! I completely forgot about them… isn’t global variables usually turned off in php? Or does defining them as you did override the basic php settings?

    I got around all this by using include() rather than wp_sidebar etc…

    Thread Starter tadramgo

    (@tadramgo)

    I’ve been trying to solve the problem by defining values in the index.php and then relying on them to indicate to the sidebar that I want to show menu items…

    eg in index.php

    if (condition) {
    $useMenu = 1;
    }

    in sidebar.php

    if ($useMenu=1;) {
    show sidebar
    }

    however for some reasons these variables aren’t available from one page to another using the wordpress “get_sidebar()” function. After testing for a while this is what I’ve concluded… is there anyway to make variables global, or pass variables to the function?

    I know this is a bit of a hacky solution, but if it works…

    cheers,
    tom

Viewing 3 replies - 1 through 3 (of 3 total)