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;
}
}
}

Leave a Reply

Your email address will not be published. Required fields are marked *

    Table Of Contents

    Related Content

    © 2020-2024 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.