Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress

Dennis Castillo
Dennis Castillo
16,018 Points

Is there anyway to edit a homepage of WordPress in HTML?

Is there anyway to edit a homepage of WordPress in HTML?

5 Answers

Hi again Dennis, I think the piece of code you are looking for to change is

 <a href="<?php echo home_url(); ?>"><?php bloginfo( 'name' ); ?></a>

specifically the area

<?php bloginfo( 'name' ); ?>

that holds the title of your site.

Now....on ways to change that... you can read this - Multiple font colors within blog title. Can it be done?.

I hope this helps :)

You are welcome

Zac Gordon
STAFF
Zac Gordon
Treehouse Guest Teacher

All of the WordPress template files are PHP. Inside of those PHP files is HTML that you can edit, but they cannot be saved as .html files.

In addition to what Zac Gordon said you can access those PHP files for editing at Admin->Appearance->Editor. Make sure you have a backup of course before editing anything.

Dennis Castillo
Dennis Castillo
16,018 Points

Oh I see... Well Just trying something on the wordpress homepage it's about the header, the H1 tags. When I check it out on my chrome dev tools it show the html codes.

<header class="main-header">
     <div id="header">
             <h1 id="logo" class="text-logo">
                  <a href="mywebsite.com">MYBLOG</a>
             </h1>
      </div>
</header>

trying something just changing the color of first two character of the header title "MYBLOG", color red so i just made some simple code on the css to make it color red.

#header h1 a span {
    color: #A30000;
}

It did work on the dev tools.

<header class="main-header">
     <div id="header">
             <h1 id="logo" class="text-logo">
                  <a href="mywebsite.com"><span>MY</span>BLOG</a>
             </h1>
      </div>
</header>

But I check it out on the actual file of wordpress it is PHP code, I read it and trying to track where I can find that word "myblog" so I just can insert the span tags, but i cant find it... It gives me conditional statement...

<header class="main-header">
            <div id="header">
                <?php if ($mts_options['mts_logo'] != '') { ?>
                    <?php if( is_front_page() || is_home() || is_404() ) { ?>
                            <h1 id="logo" class="image-logo">
                                <?php list($width, $height, $type, $attr) = getimagesize($mts_options['mts_logo']); ?>
                                <a href="<?php echo home_url(); ?>"><img src="<?php echo $mts_options['mts_logo']; ?>" alt="<?php bloginfo( 'name' ); ?>" <?php echo $attr; ?>></a>
                            </h1><!-- END #logo -->
                    <?php } else { ?>
                          <h2 id="logo" class="image-logo">
                                <?php list($width, $height, $type, $attr) = getimagesize($mts_options['mts_logo']); ?>
                                <a href="<?php echo home_url(); ?>"><img src="<?php echo $mts_options['mts_logo']; ?>" alt="<?php bloginfo( 'name' ); ?>" <?php echo $attr; ?>></a>
                            </h2><!-- END #logo -->
                    <?php } ?>
                <?php } else { ?>
                    <?php if( is_front_page() || is_home() || is_404() ) { ?>
                            <h1 id="logo" class="text-logo">
                                <a href="<?php echo home_url(); ?>"><?php bloginfo( 'name' ); ?></a>
                            </h1><!-- END #logo -->
                    <?php } else { ?>
                          <h2 id="logo" class="text-logo">
                                <a href="<?php echo home_url(); ?>"><?php bloginfo( 'name' ); ?></a>
                            </h2><!-- END #logo -->
                    <?php } ?>
                <?php } ?>
                <div class="secondary-navigation">
                    <nav id="navigation" >
                        <?php if ( has_nav_menu( 'primary-menu' ) ) { ?>
                            <?php $walker = new mts_Walker; wp_nav_menu( array( 'theme_location' => 'primary-menu', 'menu_class' => 'menu', 'container' => '', 'walker' => $walker ) ); ?>
                        <?php } else { ?>
                            <ul class="menu">
                                <?php wp_list_categories('title_li='); ?>
                            </ul>
                        <?php } ?>
                        <a href="#" id="pull"><?php _e('Menu','mythemeshop'); ?></a>
                    </nav>
                </div>
            </div>
        </header>

Is there anyway to insert that span tags? Any suggestion? what is the better way to do it? Am I doing something wrong "misdirection"? Here is my web: http://www.myblog.castillowebenterprise.com

Thanks and God Bless :)

Zac Gordon
STAFF
Zac Gordon
Treehouse Guest Teacher

The easiest way to do this, although not the best if you're a more advanced developer is to hardcode the title of your site instead of using the WordPress tag.