New Query Post
-
Hello everyone,
According MichaelH 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><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></p> <?php endwhile; } wp_reset_query(); // Restore global post data stomped by the_post(). ?>
Someone should know how to do this job?
Regards
Viewing 9 replies - 1 through 9 (of 9 total)
Viewing 9 replies - 1 through 9 (of 9 total)
- The topic ‘New Query Post’ is closed to new replies.