[wp-trac] Re: [WordPress Trac] #7874: is_sticky() to "the loop"
WordPress Trac
wp-trac at lists.automattic.com
Sun Oct 12 23:50:22 GMT 2008
#7874: is_sticky() to "the loop"
-------------------------+--------------------------------------------------
Reporter: ShaneF | Owner: anonymous
Type: enhancement | Status: reopened
Priority: normal | Milestone: 2.7
Component: General | Version: 2.7
Severity: normal | Resolution:
Keywords: |
-------------------------+--------------------------------------------------
Changes (by ShaneF):
* status: closed => reopened
* resolution: worksforme =>
* milestone: => 2.7
Comment:
{{{
/**
* Output 'Sticky', if the post is sticky.
*
* Used from within 'The Loop' to allow string output of what ever you
want,
* if the current post is a sticky post.
*
* @since 2.7.0
*
* @param str $sticky What are we outputing? default: Sticky
* @param str $before Pre-prend our text
* @param str $after What are we going to place afterwords
* @param bool $echo Default to true. False for return.
*/
function the_sticky($sticky = '', $before = '', $after = '', $echo = true)
{
global $id;
if (!is_sticky(absint($id)))
return;
if ( strlen($sticky) == 0 )
$sticky = __('Sticky');
$sticky = $before . $sticky . $after;
if ( $echo )
echo apply_filters( 'the_sticky', $sticky );
else
return apply_filters( 'the_sticky', $sticky );
}
}}}
This is what I was trying to do. For inside wp-includes/post.php
--
Ticket URL: <http://trac.wordpress.org/ticket/7874#comment:4>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list