Support » Fixing WordPress » How to stick a post in an archive.php

  • Resolved boddhi


    i made my menu with categories, so it open in an archive page.
    i’m looking for the query to make one or multi posts stick in an archive page without one more pluging please
    What do i have to put before my loop?
    I don’t whant to change the date of the post to 2032 also

    // retrieve one post with an ID of 182
    <?php if (have_posts()) : while (have_posts()) : the_post();?>
Viewing 4 replies - 1 through 4 (of 4 total)
  • The only way I know to have sticky posts show at the top of an archive page is to code a separate loop for them.

    If you don’t want them at the top you can use this code (UNTESTED):

    $sticky=get_option('sticky_posts') ;
    $sticky[] = 182;
    $args = array( 'post__in' => $sticky);

    thanks for the answer but i’m a noob in php

    in fact i’m looking to make 2 loops
    1) showing one post id=123 from the cat=1
    2) showing the rest of the post from the cat=1

    Something to do with multiple loops and query, does someone have a piece of code to save me.
    Thanks in advance

    my piece of code is not working and i don’t know what to put after

    // The Query - Customize!
    // The Loop
    if (have_posts()) : while (have_posts()) : the_post();
    <h2>Not Found</h2>

    thank you, you made my day, i found the way

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to stick a post in an archive.php’ is closed to new replies.