How to stick custom post at the top in search results

A simple hack. Edit: putting the featured post ids in an array and checking that array in the main loop. global $post; $post_IDs = array(); foreach($post_info as $post_info_obj) { $post_IDs[] = $post_info_obj->ID; } $featured_IDs = array(); $query1 = new WP_Query(array(‘meta_key’=>’sticky’,’meta_value’=>’featured’,’post__in’=>$post_IDs)); while($query1->have_posts()) { $query1->the_post(); $featured_IDs[] = $post->ID; get_property_info_li($post); } First thing do to in the main … Read more

sticky post in custom loop

if you use ‘post__in’ => get_option(‘sticky_posts’) then you are only filtering on posts that are sticky. As mrwweb said you need to look at your query. Then think of the ‘loop’ you want. Do you want to show all posts in a specific query or all posts that are sticky in all categories? You might … Read more

wp_query should show stickies first

Well for starters, the query arg showposts has been replaced by posts_per_page since WP v2.1 I don’t think any of your query args are being ignored (well, maybe save showposts; I haven’t checked to see if backwards compatibility support still exists for the arg). That said, I do not know what value your $top_row_posts variable … Read more

Sticky post appears twice

What you describe is not an issue but normal WordPress behaviour. When you mark a post as a sticky it will be at the top of the list and it will appear in it’s original postition as well, unless the original position is on the first page. A sticky will appear at the top of … Read more

Move sticky posts down in main loop

You have to change the order in $wp_query->posts. Compare it to the values from get_option( ‘sticky_posts’ ). Example: function move_stickies_down( $num = 1 ) { global $wp_query; if ( empty ( $wp_query->posts ) ) return; $stickies = get_option( ‘sticky_posts’ ); if ( empty ( $stickies ) ) return; $sticky_posts = $top = $after = array(); … Read more

Exclude Current and Sticky Post

Whenever an array of arguments is a function parameter in a WP core function it is parsed via wp_parse_args and almost always extracted into single variables. I.e. no, you cannot use the same argument twice. What you want to do is something like this: $exclude = get_option( ‘sticky_posts’ ); $exclude[] = get_the_ID(); $args = array( … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)