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 From Bootstrap to WordPress Create Bootstrap Styled Theme Templates Creating a Portfolio Single Page

Portfolio piece title and description is a link

For some reason on the single-portfolio pages all the text in the right hand side column is a hyper link. Can't see any unclosed a tags, but don't know what's causing the problem.

Here's the php

<?php get_header(); ?> 

  <div class="container">

    <div class="page-header">

      <div class="row">

        <div class="col-xs-9">
          <h1>Portfolio</h1>
        </div>

        <div class="col-xs-3 prev-next">
          <?php next_post_link( '%link', '<span class="glyphicon glyphicon-circle-arrow-left"></span>' ); ?>
          <a href="<?php bloginfo('url'); ?>/?p=73"><span class="glyphicon glyphicon-th"></span></a>
          <?php previous_post_link( '%link', '<span class="glyphicon glyphicon-circle-arrow-right"></span>' ); ?>
        </div>

      </div>

    </div>

    <div class="row">

      <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

        <div class="col-sm-8 portfolio-image">
          <?php
            $thumbnail_id = get_post_thumbnail_id();
            $thumbnail_url = wp_get_attachment_image_src( $thumbnail_id, 'thumbnail-size', true );
          ?>

        <p><a href="<?php the_permalink(); ?>"><img src="<?php echo $thumbnail_url[0]; ?>" alt="<?php the_title();?> graphic"</a></p>

        </div>

        <div class="col-sm-4">

          <h1><?php the_title(); ?></h1> 
          <?php the_content(); ?>
          <p><a class="btn btn-large btn-primary" href="<?php the_field('link'); ?>">View Final Piece</a></p>
        </div>


      <?php endwhile; else: ?>

        <div class="page-header">
          <h1>Oh no!</h1>        
        </div>

        <p>No content is appearing for this page!</p>

      <?php endif;?>



    </div>

<?php get_footer(); ?>

2 Answers

Hi Nick,

The following line doesn't look to be closing the img tag after the alt so:

        <p><a href="<?php the_permalink(); ?>"><img src="<?php echo $thumbnail_url[0]; ?>" alt="<?php the_title();?> graphic"</a></p>

should be:

        <p><a href="<?php the_permalink(); ?>"><img src="<?php echo $thumbnail_url[0]; ?>" alt="<?php the_title();?> graphic"></a></p>

Does closing this resolve the issue?

-Rich

Thanks Rich!

No problem :)