php - WP 2 loops. 1st Sticky Posts, 2nd Non Sticky Posts -


i'll start saying i'm terrible @ php. can modify simple codes have no clue i'm doing when have write own.

the goal: display 2 loops on wordpress index.php page 1 specific category. first loop should display sticky post, second other posts.

the category display '28'.

i have found page: http://codex.wordpress.org/sticky_posts don't know how put in action.

i have spend hours try , work without success.

so loop 1 should this:

--- cat 28 show post id35.

loop 2 should this:

--- cat 28 show non sticky posts (so exclude stickies)

if me i'd happy. it's been 2 days , still can't >.>

thanks!

get latest sticky post.

<?php $sticky = get_option( ‘sticky_posts’ ); query_posts( array( ‘cat’ => 28, ‘post__in’ => $sticky, ‘orderby’ => id, ‘showposts’ => 2 ) ); ?> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <a href=”<?php the_permalink(); ?>” rel=”bookmark” title=”permanent link <?php the_title(); ?>”> <?php endwhile;?> <?php endif; wp_reset_query(); ?> 

exclude sticky posts list of recent posts

<?php $sticky = get_option(‘sticky_posts’) ;  $post_to_exclude[] = $sticky[0];  $args=array( ‘cat’ => 28, ‘showposts’=>10, ‘post__not_in’=> $post_to_exclude, );  query_posts($args); ?>  <h2><a href=”<?php the_permalink() ?>”><?php the_title(); ?></a> </h2>  <?php while (have_posts()) : the_post();  ?>  <?php endwhile;?> 

Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -