is_home example

$tag_name = 'h1';
    $classes  = empty( $attributes['textAlign'] ) ? '' : "has-text-align-{$attributes['textAlign']}";
    if ( isset( $attributes['style']['elements']['link']['color']['text'] ) ) {
        $classes .= ' has-link-color';
    }

    if ( isset( $attributes['level'] ) ) {
        $tag_name = 0 === $attributes['level'] ? 'p' : 'h' . (int) $attributes['level'];
    }

    if ( $attributes['isLink'] ) {
        $aria_current = is_home() || ( is_front_page() && 'page' === get_option( 'show_on_front' ) ) ? ' aria-current="page"' : '';
        $link_target  = ! empty( $attributes['linkTarget'] ) ? $attributes['linkTarget'] : '_self';

        $site_title = sprintf(
            '<a href="%1$s" target="%2$s" rel="home"%3$s>%4$s</a>',
            esc_url( home_url() ),
            esc_attr( $link_target ),
            $aria_current,
            esc_html( $site_title )
        );
    }
    $wrapper_attributes = get_block_wrapper_attributes( array( 'class' => trim( $classes ) ) );

    
    } elseif ( is_post_type_archive() ) {
        $title['title'] = post_type_archive_title( '', false );

        // If on a taxonomy archive, use the term title.     } elseif ( is_tax() ) {
        $title['title'] = single_term_title( '', false );

        /* * If we're on the blog page that is not the homepage * or a single post of any post type, use the post title. */
    } elseif ( is_home() || is_singular() ) {
        $title['title'] = single_post_title( '', false );

        // If on a category or tag archive, use the term title.     } elseif ( is_category() || is_tag() ) {
        $title['title'] = single_term_title( '', false );

        // If on an author archive, use the author's display name.     } elseif ( is_author() && get_queried_object() ) {
        $author         = get_queried_object();
        $title['title'] = $author->display_name;

        


get_header(); ?> <?php if ( is_home() && ! is_front_page() && ! empty( single_post_title( '', false ) ) ) : ?> <header class="page-header alignwide"> <h1 class="page-title"><?php single_post_title(); ?></h1> </header><!-- .page-header --> <?php endif; ?> <?php if ( have_posts() ) {

    // Load posts loop.     while ( have_posts() ) {
        the_post();

        
<?php endif; ?> <div class="site-branding"> <?php if ( has_custom_logo() && ! $show_title ) : ?> <div class="site-logo"><?php the_custom_logo(); ?></div> <?php endif; ?> <?php if ( $blog_info ) : ?> <?php if ( is_front_page() && ! is_paged() ) : ?> <h1 class="<?php echo esc_attr( $header_class ); ?>"><?php echo esc_html( $blog_info ); ?></h1> <?php elseif ( is_front_page() && ! is_home() ) : ?> <h1 class="<?php echo esc_attr( $header_class ); ?>"><a href="<?php echo esc_url( home_url( '/' ) ); ?>"><?php echo esc_html( $blog_info ); ?></a></h1> <?php else : ?> <p class="<?php echo esc_attr( $header_class ); ?>"><a href="<?php echo esc_url( home_url( '/' ) ); ?>"><?php echo esc_html( $blog_info ); ?></a></p> <?php endif; ?> <?php endif; ?> <?php if ( $description && true === get_theme_mod( 'display_title_and_tagline', true ) ) : ?> <p class="site-description"> <?php echo $description; // phpcs:ignore WordPress.Security.EscapeOutput ?> </p> <?php endif; ?>
<?php                 wp_list_categories(
                    array(
                        'show_count' => 1,
                        'title_li'   => '<h2>' . __( 'Categories' ) . '</h2>',
                    )
                );
                ?> </ul> <ul> <?php if ( is_home() || is_page() ) { /* If this is the frontpage */ ?> <?php wp_list_bookmarks(); ?> <li><h2><?php _e( 'Meta' ); ?></h2> <ul> <?php wp_register(); ?> <li><?php wp_loginout(); ?></li> <?php wp_meta(); ?> </ul> </li> <?php } ?>
 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.     $taxonomies = get_taxonomies( array( 'public' => true ) );

    

function is_home() {
    global $wp_query;

    if ( ! isset( $wp_query ) ) {
        _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1.0' );
        return false;
    }

    return $wp_query->is_home();
}

/** * Determines whether the query is for the Privacy Policy page. * * The Privacy Policy page is the page that shows the Privacy Policy content of the site. * * is_privacy_policy() is dependent on the site's "Change your Privacy Policy page" Privacy Settings 'wp_page_for_privacy_policy'. * * This function will return true only on the page you set as the "Privacy Policy page". * * For more information on this and similar theme functions, check out * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/ * Conditional Tags} article in the Theme Developer Handbook. * * @since 5.2.0 * * @global WP_Query $wp_query WordPress Query object. * * @return bool Whether the query is for the Privacy Policy page. */
</h1> <?php else : ?> <h1 class="page-title"><?php esc_html_e( 'Nothing here', 'twentytwentyone' ); ?></h1> <?php endif; ?> </header><!-- .page-header --> <div class="page-content default-max-width"> <?php if ( is_home() && current_user_can( 'publish_posts' ) ) : ?> <?php             printf(
                '<p>' . wp_kses(
                    /* translators: %s: Link to WP admin new post page. */
                    __( 'Ready to publish your first post? <a href="%s">Get started here</a>.', 'twentytwentyone' ),
                    array(
                        'a' => array(
                            'href' => array(),
                        ),
                    )
                )

    public function is_front_page() {
        // Most likely case.         if ( 'posts' === get_option( 'show_on_front' ) && $this->is_home() ) {
            return true;
        } elseif ( 'page' === get_option( 'show_on_front' ) && get_option( 'page_on_front' )
            && $this->is_page( get_option( 'page_on_front' ) )
        ) {
            return true;
        } else {
            return false;
        }
    }

    /** * Determines whether the query is for the blog homepage. * * This is the page which shows the time based blog content of your site. * * Depends on the site's "Front page displays" Reading Settings 'show_on_front' and 'page_for_posts'. * * If you set a static page for the front page of your site, this function will return * true only on the page you set as the "Posts page". * * @since 3.1.0 * * @see WP_Query::is_front_page() * * @return bool Whether the query is for the blog homepage. */


            // We will 404 for paged queries, as no posts were found.         } elseif ( ! is_paged() ) {
            $author = get_query_var( 'author' );

            // Don't 404 for authors without posts as long as they matched an author on this site.             if ( is_author() && is_numeric( $author ) && $author > 0 && is_user_member_of_blog( $author )
                // Don't 404 for these queries if they matched an object.                 || ( is_tag() || is_category() || is_tax() || is_post_type_archive() ) && get_queried_object()
                // Don't 404 for these queries either.                 || is_home() || is_search() || is_feed()
            ) {
                $set_404 = false;
            }
        }

        if ( $set_404 ) {
            // Guess it's time to 404.             $wp_query->set_404();
            status_header( 404 );
            nocache_headers();
        } else {
            
 elseif ( is_page() && ! empty( $_GET['page_id'] ) && ! $redirect_url ) {
            $redirect_url = get_permalink( get_query_var( 'page_id' ) );
            $redirect_obj = get_post( get_query_var( 'page_id' ) );

            if ( $redirect_url ) {
                $redirect['query'] = remove_query_arg( 'page_id', $redirect['query'] );
            }
        } elseif ( is_page() && ! is_feed() && ! $redirect_url
            && 'page' === get_option( 'show_on_front' ) && get_queried_object_id() === (int) get_option( 'page_on_front' )
        ) {
            $redirect_url = home_url( '/' );
        } elseif ( is_home() && ! empty( $_GET['page_id'] ) && ! $redirect_url
            && 'page' === get_option( 'show_on_front' ) && get_query_var( 'page_id' ) === (int) get_option( 'page_for_posts' )
        ) {
            $redirect_url = get_permalink( get_option( 'page_for_posts' ) );
            $redirect_obj = get_post( get_option( 'page_for_posts' ) );

            if ( $redirect_url ) {
                $redirect['query'] = remove_query_arg( 'page_id', $redirect['query'] );
            }
        } elseif ( ! empty( $_GET['m'] ) && ( is_year() || is_month() || is_day() ) ) {
            $m = get_query_var( 'm' );

            

function render_block_core_home_link( $attributes$content$block ) {
    if ( empty( $attributes['label'] ) ) {
        return '';
    }

    $aria_current = is_home() || ( is_front_page() && 'page' === get_option( 'show_on_front' ) ) ? ' aria-current="page"' : '';

    return sprintf(
        '<li %1$s><a class="wp-block-home-link__content wp-block-navigation-item__content" href="%2$s" rel="home"%3$s>%4$s</a></li>',
        block_core_home_link_build_li_wrapper_attributes( $block->context ),
        esc_url( home_url() ),
        $aria_current,
        wp_kses_post( $attributes['label'] )
    );
}

/** * Register the home block * * @uses render_block_core_home_link() * @throws WP_Error An WP_Error exception parsing the block definition. */
Home | Imprint | This part of the site doesn't use cookies.