Title: Query question
Last modified: August 19, 2016

---

# Query question

 *  [fionagilbert](https://wordpress.org/support/users/fionagilbert/)
 * (@fionagilbert)
 * [16 years, 6 months ago](https://wordpress.org/support/topic/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: [http://paste-it.net/public/s8d64b4/](http://paste-it.net/public/s8d64b4/)
 * Any help greatly appreciated,
 * Fiona

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

 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [16 years, 6 months ago](https://wordpress.org/support/topic/query-question/#post-1298549)
 * Change:
    `$query1->query('&showposts=5&cat=');` to `$query1->query('&posts_per_page
   =5&cat=');`
 * 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?
 *  Thread Starter [fionagilbert](https://wordpress.org/support/users/fionagilbert/)
 * (@fionagilbert)
 * [16 years, 6 months ago](https://wordpress.org/support/topic/query-question/#post-1298607)
 * 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
 * Fiona
 *  Thread Starter [fionagilbert](https://wordpress.org/support/users/fionagilbert/)
 * (@fionagilbert)
 * [16 years, 6 months ago](https://wordpress.org/support/topic/query-question/#post-1298665)
 * Hi again,
 * This is my second attempt 🙂
 * [http://paste-it.net/public/d3808bc/](http://paste-it.net/public/d3808bc/)
 * 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?
 * Thanks,
    Fiona
 *  [Jess](https://wordpress.org/support/users/jessn/)
 * (@jessn)
 * [16 years, 6 months ago](https://wordpress.org/support/topic/query-question/#post-1298699)
 * 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.

## Tags

 * [query](https://wordpress.org/support/topic-tag/query/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 4 replies
 * 3 participants
 * Last reply from: [Jess](https://wordpress.org/support/users/jessn/)
 * Last activity: [16 years, 6 months ago](https://wordpress.org/support/topic/query-question/#post-1298699)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
