Stick multiple posts in a single category

Your category.php should have two loops — one for stickies, one for regular posts: <?php // get sticky posts array $sticky = get_option(‘sticky_posts’); // First WP_Query arguments $args = array( // include stickies ‘post__in’ => $sticky ); $query = new WP_Query( $args ); // First loop for stickies only if ( $query->have_posts() ) : while … Read more

Store sticky post’s ids in a transient

You can try: add_action(‘update_option_sticky_posts’, function( $old_value, $value ) { $featured_args = array( ‘post__in’ => $value, ‘post_status’ => ‘publish’, ‘no_found_rows’ => true ); // The Featured Posts query. $featured = new WP_Query( $featured_args ); // Proceed only if published posts with thumbnails exist if ( $featured->have_posts() ) { while ( $featured->have_posts() ) { $featured->the_post(); if ( … Read more

How to retrieve “sticky” post outside the “loop”?

I am using this query; <?php $sticky = get_option( ‘sticky_posts’ ); // Get all sticky posts rsort( $sticky ); // Sort the stickies, latest first $sticky = array_slice( $sticky, 0, 1 ); // Number of stickies to show query_posts( array( ‘post__in’ => $sticky, ‘caller_get_posts’ => 1 ) ); // The query if (have_posts() ) { … Read more

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