wp_loginout example

if ( 'html5' === $format ) {
            // The title may be filtered: Strip out HTML and make sure the aria-label is never empty.             $title      = trim( strip_tags( $title ) );
            $aria_label = $title ? $title : $default_title;
            echo '<nav aria-label="' . esc_attr( $aria_label ) . '">';
        }
        ?> <ul> <?php wp_register(); ?> <li><?php wp_loginout(); ?></li> <li><a href="<?php echo esc_url( get_bloginfo( 'rss2_url' ) ); ?>"><?php _e( 'Entries feed' ); ?></a></li> <li><a href="<?php echo esc_url( get_bloginfo( 'comments_rss2_url' ) ); ?>"><?php _e( 'Comments feed' ); ?></a></li> <?php             /** * Filters the "WordPress.org" list item HTML in the Meta widget. * * @since 3.6.0 * @since 4.9.0 Added the `$instance` parameter. * * @param string $html Default HTML for the WordPress.org list item. * @param array $instance Array of settings for the current widget. */

function render_block_core_loginout( $attributes ) {

    // Build the redirect URL.     $current_url = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];

    $classes  = is_user_logged_in() ? 'logged-in' : 'logged-out';
    $contents = wp_loginout(
        isset( $attributes['redirectToCurrent'] ) && $attributes['redirectToCurrent'] ? $current_url : '',
        false
    );

    // If logged-out and displayLoginAsForm is true, show the login form.     if ( ! is_user_logged_in() && ! empty( $attributes['displayLoginAsForm'] ) ) {
        // Add a class.         $classes .= ' has-login-form';

        // Get the form.         $contents = wp_login_form( array( 'echo' => false ) );
    }

                );
                ?> </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 } ?> <?php endif; /* ! dynamic_sidebar() */ ?> </ul> </div>
Home | Imprint | This part of the site doesn't use cookies.