How to display a sticky post inside a div?

You could simply follow the example from the Codex: $sticky = get_option( ‘sticky_posts’ ); $query = new WP_Query( ‘p=’ . $sticky[0] ); The variable $sticky will hold an array of IDs, and you access the first sticky post via $sticky[0]. Then you need the WordPress Loop: if ( $query->have_posts() ) { while ( $query->have_posts() ) … Read more

How to display sticky post with custom html

Your code looks odd to me, typically to insert something between posts you add a counter and count each loop, then add custom code on a particular count, this is for the main loop, for a non main loop or secondary loop us wp_query. <?php if (have_posts()) : ?> <?php $count = 0; ?> <?php … Read more

Custom query: how to get the sticky posts first?

Further upgrade: just built a class to place in functions.php or maybe in a plugin. I did that mainly because I want almost always have sticky posts, probably in more loops per page. So got a lot of duplication. Therefore here is a basic class, that certainly can be exapanded/perfectioned some way, but for my … Read more

Make posts non-sticky

You can use a simple script which you run once and remove. The idea is to replace the sticky post array with an array of the 4 desired ID’s PHP 5.4+ version – short array syntax add_action( ‘init’, function () { // Define our new array $stickies = [1,2,3,4]; // Change to match your own … Read more

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