Weblogtoolscollection News » Help and Support

Exclude sticky posts at the top

  • Topic started 4 years ago
  • 1 posts so far
  • Latest reply from werlisa

  1. Hello everyone,

    According Wordpress official forum instructions should create a new Query Post to solve the problem of sticky posts at the top of my index, I want these sticky posts do not appear anchored to the top of my index and disappear in order of publication but are not as do so.

    This is the Query existing post in my topic.

    <?php
    $i = 1;
    if(!empty($_GET['sort']))
    {
    $orderby=trim($_GET['sort']);
    $order=trim($_GET['order']);
    $key=trim($_GET['key']);
    // create the sort by injection
    $posts = query_posts($query_string . '&orderby='.$orderby.'&meta_key='.$key.'&order='.$order.'');
    }
    if (have_posts()) : ?>
    <?php while (have_posts()) : the_post(); ?>
    <?php if ($i % 2 == 0) { $alt = " class=\"alt\""; } else { $alt = " class=\"no\""; } echo "<div" . $alt;
    if (is_sticky()) { echo " id='sticky' "; } echo ">";
    ?>

    And this is the example again proposed by MIchaelH Post Query.

    <?php
    $args=array(
    'meta_key'=>$key,
    'orderby'=> $orderby,
    'order' => $ordr,
    'post_type' => 'post',
    'post_status' => 'publish',
    'posts_per_page' => -1,
    'caller_get_posts'=> 1
    );
    $my_query = null;
    $my_query = new WP_Query($args);
    if( $my_query->have_posts() ) {
    while ($my_query->have_posts()) : $my_query->the_post(); ?>
    <p>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></p>
    <?php
    endwhile;
    }
    wp_reset_query(); // Restore global post data stomped by the_post().
    ?>

    Someone should know how to do this job?

    Regards

    Posted: 4 years #

RSS feed for this thread

This topic has been closed to new replies.


Back to top

0.126 - 12 queries