• If anyone could help me simplify this code on my Template Page I’d be eternally grateful:

    <?php if (is_page(‘eastern-cape’)) {
    query_posts(‘cat=4&showposts=10’);
    }
    elseif (is_page(‘free-state’)) {
    query_posts(‘cat=10&showposts=10’);
    }
    elseif (is_page(‘gauteng’)) {
    query_posts(‘cat=13&showposts=13’);
    }
    elseif (is_page(‘kwazulu-natal’)) {
    query_posts(‘cat=14&showposts=14’);
    }
    elseif (is_page(‘limpopo’)) {
    query_posts(‘cat=15&showposts=15’);
    }
    elseif (is_page(‘mpumalanga’)) {
    query_posts(‘cat=16&showposts=16’);
    }
    elseif (is_page(‘north-west’)) {
    query_posts(‘cat=17&showposts=17’);
    }
    elseif (is_page(‘northern-cape’)) {
    query_posts(‘cat=18&showposts=18’);
    }
    elseif (is_page(‘western-cape’)) {
    query_posts(‘cat=19&showposts=19’);
    }

    ?>

    I was hoping to maybe just use:

    <?php if (is_page(‘where this would get the current page slug’)) {
    query_posts(‘cat=and this-would-get-the-current-page-ID&showposts=10’);
    }

    Please any help would be great. Although I could live with the 9 queries above (which are provinces of South Africa, but on another page I have to have all the cities/towns which would be hundreds……

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Simplify query_posts’ is closed to new replies.