Support » Fixing WordPress » Query question

  • Hi all,

    I am trying to code a query so I am able to show an ajax featured post slideshow just for categories, now PHP is not my strong point and wondered if any one could review this code and tell me if I have done it correctly.

    I don’t want to specify a category, I just want category generated when I click said categories hyperlink.

    This is my code:

    Any help greatly appreciated,


Viewing 4 replies - 1 through 4 (of 4 total)
  • esmi


    Forum Moderator


    perhaps? showposts has been deprecated in favour of posts_per_page and will (presumably) disappear in the not-too-distant-future.

    The logic and syntax seems OK to me – apart from $a seems unused.

    Edit: where’s the cat id being pulled from?

    Good call esmi,

    This code is being used in a category.php page.

    So really I should incorporate ‘<?php if (is_category()) { ?>’ within the code I presume. If I’m honest I am not sure where. Could you guide me please?

    Thank you


    Hi again,

    This is my second attempt 🙂

    Now this works but my entries below the featured section display the same content as featured section. How do I show the next 5 entries after the featured section please?


    Try the offset option:

    <!– Entries below the featured section –>
    <?php $c = 1; $query3 = new WP_Query();$query3->query(‘posts_per_page=5&offset=5&cat=’ . get_query_var(‘cat’)); ?>

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Query question’ is closed to new replies.