We're offering a free six-month trial of Hookline: Atmos - a plugin that adds a Gravity Forms element for Oxygen Builder. Get it today!

function bitt_get_sticky_posts()

Fetches the list of sticky posts from WordPress and returns them in a comma-separated value.

Useful for queries when you only want to get the sticky posts. You can then use the return value of this function for the post__in parameter.

function Code

if(!function_exists(‘bitt_get_sticky_posts’)) {
function bitt_get_sticky_posts() {
$sticky = get_option( ‘sticky_posts’ );
if($sticky) {
$sticky_posts= implode(‘,’, $sticky);
return $sticky_posts;
}
}
}

Table Of Contents

Related Content

© 2020-2023 Luxibay
Name(Required)
Please let us know what's on your mind. Have a question for us? Ask away.
This field is for validation purposes and should be left unchanged.