Forums

Sticky Post moved when I limit posts (4 posts)

  1. dpbklyn
    Member
    Posted 8 months ago #

    Hello and thank you in advance:

    I am creating a custom theme for a client and I hav run into a weird issue (ok, maybe it isn't so weird)...

    I am trying to have a sticky post on the top of my home page then limit the rest of the posts on the page to a particular category "Upcoming Speakers". I am using the following code before the Loop to limit the categories:

    <?php if (is_front_page()) { query_posts( 'cat=3' ); } ?>

    When I don't limit the page everything works as expected:

    <STICKY>
    <POST>

    When I limit the categories the regular post becomes the top post and the sticky post drops down the list:

    <POST>
    <STICKY>

    I have tried putting the post and the sticky in the same category and I have had them in separate categories and I altered my query to include both category numbers:

    <?php if (is_front_page()) { query_posts( 'cat=3,5' ); } ?>

    I have also tried altering the PHP to call the sticky category first:

    <?php if (is_front_page()) { query_posts( 'cat=5,3' ); } ?>

    Any help is greatly appreciated!

    Thank you,

    dp

  2. esmi
    Theme Diva & Forum Moderator
    Posted 8 months ago #

    You're going to need 2 Loops - one for the sticky post and a second for the rest of the posts.

  3. dpbklyn
    Member
    Posted 8 months ago #

    Esmi,

    Thank you for the quick reply!

    I am far from an expert here...I am doing this as a favor (file under: no good deed goes unpunished)

    Would the loops just sit on my index.php next to each other and would I then limit each loop to a particular category one for the sticky and one for the other?

    like so: (I am breaking it up here for ease of viewing--otherwise I wouldn't break it up)

    [Code moderated as per the Forum Rules. Please use the pastebin]

    dp

  4. esmi
    Theme Diva & Forum Moderator
    Posted 8 months ago #

Reply

You must log in to post.

About this Topic