I currently have a theme that was created by another developer and I just need to change a few small things to get it finished.

I'm a little stuck on this one point: A section of the home page pulls in the latest blog entries, but instead of having the links go to the post when you click on the title, it just goes to a certain page. I need to change the link so that when you click on a post title, it takes you to that post.

This is the current code:

            // Start the Loop.               
            $args = array('post_type'=>'article ','order' => 'ASC');
            query_posts( $args );                
            while ( have_posts() ) : the_post();
             echo '<div class="slide">';
              if ( has_post_thumbnail() ) {
              the_post_thumbnail('large'); //To show image
            echo '<div class="blog_content"> <div class="blog_date">';
              //echo date('d F y' strtotime(the_time()));
               the_time('d F y');
             echo '</div>';              
              echo '<div class="blog_title"> <a target="_blank" href='. esc_url( home_url( '/case-studies' ) ) .'>';
             the_title();//To show title        
             echo '</a></div></div></div>'; 

How should I put the link into this section "href='. esc_url( home_url( '/case-studies' ) ) .'> so that it links to the post?

I've tried a few things I saw on codex.wordpress.org but they didn't work so I'm obviously not using it right.


I've tried a few things I saw on codex.wordpress.org...

Such as...?

Have you tried:

href='. get_permalink() .'>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.