Need help with some PHP code (3 posts)

  1. cmbuchanan
    Posted 4 years ago #

    I hope I'm posting this in the right place. One of my clients had someone built him a custom wordpress theme, but the original designer didn't add the finishing touches. I'm stuck on some php coding that I can't figure out. One the home page http://chuckwardrealestate.com/ you'll see the featured properties section. This is the code calling this featured properties box:

    [ Code edited with backticks. Moderator note: when sharing code examples, please wrap the code in backticks or use the code button. ]

    <div class="bordercontent"><h2> Featured Properties </h2></div>
    			<div class="topleftimagecontent">
    			<?php query_posts('cat=4&posts_per_page=6');
    			if (have_posts()) : while (have_posts()) : the_post(); ?>
    			<div class="topFeaturedimage">
    			  <div class="Featuredimage"><?php the_post_thumbnail();?></div>
    			  <div class="Featuredtitle"> <p> <?php the_title(); ?></p></div>
    			<?php endwhile; endif; ?>
    			<?php wp_reset_query(); ?>

    The appearance is fine, but I need to add functionality. What I want to happen is to make the images clickable so that you can go to the posts where the images are. I don't know enough about php to write this code. Can anyone help me with this?

  2. Michael
    Forum Moderator
    Posted 4 years ago #

    <div class="Featuredimage"><a href="<?php the_permalink(); ?>"><?php the_post_thumbnail();?></a></div>


  3. cmbuchanan
    Posted 4 years ago #

    Thank you so much! That's exactly what I needed to know. I knew it would be something simple that would make me want to smack myself on the head for not figuring it out.

Topic Closed

This topic has been closed to new replies.

About this Topic