• 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: https://paste-it.net/public/s8d64b4/

    Any help greatly appreciated,

    Fiona

Viewing 4 replies - 1 through 4 (of 4 total)
  • 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

    (@fionagilbert)

    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

    (@fionagilbert)

    Hi again,

    This is my second attempt ??

    https://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

    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.