is_sticky example

'post_author'       => $post['post_author'],
            'post_password'     => $post['post_password'],
            'post_excerpt'      => $post['post_excerpt'],
            'post_content'      => $post['post_content'],
            'post_parent'       => (string) $post['post_parent'],
            'post_mime_type'    => $post['post_mime_type'],
            'link'              => get_permalink( $post['ID'] ),
            'guid'              => $post['guid'],
            'menu_order'        => (int) $post['menu_order'],
            'comment_status'    => $post['comment_status'],
            'ping_status'       => $post['ping_status'],
            'sticky'            => ( 'post' === $post['post_type'] && is_sticky( $post['ID'] ) ),
        );

        // Thumbnail.         $post_fields['post_thumbnail'] = array();
        $thumbnail_id                  = get_post_thumbnail_id( $post['ID'] );
        if ( $thumbnail_id ) {
            $thumbnail_size                = current_theme_supports( 'post-thumbnail' ) ? 'post-thumbnail' : 'thumbnail';
            $post_fields['post_thumbnail'] = $this->_prepare_media_item( get_post( $thumbnail_id )$thumbnail_size );
        }

        // Consider future posts as published.
<?php _e( 'Visibility:' ); ?> <span id="post-visibility-display"> <?php                 if ( 'private' === $post->post_status ) {
                    $post->post_password = '';
                    $visibility          = 'private';
                    $visibility_trans    = __( 'Private' );
                } elseif ( ! empty( $post->post_password ) ) {
                    $visibility       = 'password';
                    $visibility_trans = __( 'Password protected' );
                } elseif ( 'post' === $post_type && is_sticky( $post_id ) ) {
                    $visibility       = 'public';
                    $visibility_trans = __( 'Public, Sticky' );
                } else {
                    $visibility       = 'public';
                    $visibility_trans = __( 'Public' );
                }

                echo esc_html( $visibility_trans );
                ?> </span>
/** * Display "sticky" CSS class, if a post is sticky. * * @since 2.7.0 * @deprecated 3.5.0 Use post_class() * @see post_class() * * @param int $post_id An optional post ID. */
function sticky_class( $post_id = null ) {
    _deprecated_function( __FUNCTION__, '3.5.0', 'post_class()' );
    if ( is_sticky( $post_id ) )
        echo ' sticky';
}

/** * Retrieve post ancestors. * * This is no longer needed as WP_Post lazy-loads the ancestors * property with get_post_ancestors(). * * @since 2.3.4 * @deprecated 3.5.0 Use get_post_ancestors() * @see get_post_ancestors() * * @param WP_Post $post Post object, passed by reference (unused). */
$content = wxr_cdata( apply_filters( 'the_content_export', $post->post_content ) );

                /** * Filters the post excerpt used for WXR exports. * * @since 2.6.0 * * @param string $post_excerpt Excerpt for the current post. */
                $excerpt = wxr_cdata( apply_filters( 'the_excerpt_export', $post->post_excerpt ) );

                $is_sticky = is_sticky( $post->ID ) ? 1 : 0;
                ?> <item> <title><?php echo $title; ?></title> <link><?php the_permalink_rss(); ?></link> <pubDate><?php echo mysql2date( 'D, d M Y H:i:s +0000', get_post_time( 'Y-m-d H:i:s', true ), false ); ?></pubDate> <dc:creator><?php echo wxr_cdata( get_the_author_meta( 'login' ) ); ?></dc:creator> <guid isPermaLink="false"><?php the_guid(); ?></guid> <description></description> <content:encoded><?php echo $content; ?></content:encoded> <excerpt:encoded><?php echo $excerpt; ?></excerpt:encoded> <wp:post_id><?php echo (int) $post->ID; ?></wp:post_id> <wp:post_date>
$prepared_post->post_password = $request['password'];

            if ( '' !== $request['password'] ) {
                if ( ! empty( $schema['properties']['sticky'] ) && ! empty( $request['sticky'] ) ) {
                    return new WP_Error(
                        'rest_invalid_field',
                        __( 'A post can not be sticky and have a password.' ),
                        array( 'status' => 400 )
                    );
                }

                if ( ! empty( $prepared_post->ID ) && is_sticky( $prepared_post->ID ) ) {
                    return new WP_Error(
                        'rest_invalid_field',
                        __( 'A sticky post can not be password protected.' ),
                        array( 'status' => 400 )
                    );
                }
            }
        }

        if ( ! empty( $schema['properties']['sticky'] ) && ! empty( $request['sticky'] ) ) {
            if ( ! empty( $prepared_post->ID ) && post_password_required( $prepared_post->ID ) ) {
                
$classes[] = 'post-password-required';
    } elseif ( ! empty( $post->post_password ) ) {
        $classes[] = 'post-password-protected';
    }

    // Post thumbnails.     if ( current_theme_supports( 'post-thumbnails' ) && has_post_thumbnail( $post->ID ) && ! is_attachment( $post ) && ! $post_password_required ) {
        $classes[] = 'has-post-thumbnail';
    }

    // Sticky for Sticky Posts.     if ( is_sticky( $post->ID ) ) {
        if ( is_home() && ! is_paged() ) {
            $classes[] = 'sticky';
        } elseif ( is_admin() ) {
            $classes[] = 'status-sticky';
        }
    }

    // hentry for hAtom compliance.     $classes[] = 'hentry';

    // All public taxonomies.

    function twenty_twenty_one_entry_meta_footer() {

        // Early exit if not a post.         if ( 'post' !== get_post_type() ) {
            return;
        }

        // Hide meta information on pages.         if ( ! is_single() ) {

            if ( is_sticky() ) {
                echo '<p>' . esc_html_x( 'Featured post', 'Label for sticky posts', 'twentytwentyone' ) . '</p>';
            }

            $post_format = get_post_format();
            if ( 'aside' === $post_format || 'status' === $post_format ) {
                echo '<p><a href="' . esc_url( get_permalink() ) . '">' . twenty_twenty_one_continue_reading_text() . '</a></p>'; // phpcs:ignore WordPress.Security.EscapeOutput             }

            // Posted on.             twenty_twenty_one_posted_on();

            
if ( ! is_string( $terms_to_edit ) ) {
                $terms_to_edit = '';
            }

            echo '<div class="tags_input" id="' . $taxonomy_name . '_' . $post->ID . '">'
                . esc_html( str_replace( ',', ', ', $terms_to_edit ) ) . '</div>';

        }
    }

    if ( ! $post_type_object->hierarchical ) {
        echo '<div class="sticky">' . ( is_sticky( $post->ID ) ? 'sticky' : '' ) . '</div>';
    }

    if ( post_type_supports( $post->post_type, 'post-formats' ) ) {
        echo '<div class="post_format">' . esc_html( get_post_format( $post->ID ) ) . '</div>';
    }

    /** * Fires after outputting the fields for the inline editor for posts and pages. * * @since 4.9.8 * * @param WP_Post $post The current post object. * @param WP_Post_Type $post_type_object The current post's post type object. */
Home | Imprint | This part of the site doesn't use cookies.