Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

header.php code cleanup #1

Closed
justintadlock opened this issue Nov 27, 2013 · 2 comments
Closed

header.php code cleanup #1

justintadlock opened this issue Nov 27, 2013 · 2 comments

Comments

@justintadlock
Copy link

Here's a cleaned up version of header.php:

<!DOCTYPE html>
<html <?php language_attributes( 'html' ); ?>>

<head>
<?php wp_head(); // Hook required for scripts, styles, and other <head> items. ?>
</head>

<body <?php hybrid_attr( 'body' ); ?>>

    <div id="container">

        <?php hybrid_get_menu( 'primary' ); // Loads the menu/primary.php template. ?>

        <div class="wrap">

            <header <?php hybrid_attr( 'header' ); ?>>

                <?php if ( display_header_text() ) : // If user chooses to display header text. ?>

                    <div id="branding">
                        <?php echo get_avatar( get_option( 'admin_email' ), 160 ); ?>
                        <?php hybrid_site_title(); ?>
                        <?php hybrid_site_description(); ?>
                        <?php hybrid_get_menu( 'social' ); // Loads the menu/social.php template. ?>
                    </div><!-- #branding -->

                <?php endif; // End check for header text. ?>

            </header><!-- #header -->

            <?php if ( get_header_image() && !display_header_text() ) : // If there's a header image but no header text. ?>

                <a href="<?php echo home_url(); ?>" title="<?php echo esc_attr( get_bloginfo( 'name' ) ); ?>" rel="home"><img class="header-image" src="<?php header_image(); ?>" width="<?php echo get_custom_header()->width; ?>" height="<?php echo get_custom_header()->height; ?>" alt="" /></a>

            <?php elseif ( get_header_image() ) : // If there's a header image. ?>

                <img class="header-image" src="<?php header_image(); ?>" width="<?php echo get_custom_header()->width; ?>" height="<?php echo get_custom_header()->height; ?>" alt="" />

            <?php endif; // End check for header image. ?>

            <div id="main" class="main">

                <?php hybrid_get_menu( 'breadcrumbs' ); // Loads the menu/breadcrumbs.php template. ?>
@justintadlock
Copy link
Author

I figured it was easier for me to post it here instead of in my review notes. I removed some whitespace, fixed some code tabbing, and consolidated the avatar code into a single line.

Of course, GitHub uses spaces instead of tabs, so you might not want to copy/paste the above. Just use it as a reference.

@pollyplummer
Copy link
Owner

Thanks, fixed. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants