wp_query function with links

on this site i’m using the following code to pull in the 2 most recent posts in the middle footer widget.


<?php
$custom_query = new WP_Query( 'posts_per_page=2&cat=1' );
if ( $custom_query->have_posts() ) : while ( $custom_query->have_posts() ) : $custom_query->the_post(); ?>

<p id="title"><?php the_title(); ?></p>
<p id="small-date">Posted on: <?php the_time('F j, Y') ?></p>
<?php the_excerpt(); ?>
<hr /> 
<?php endwhile; else : ?>

<h3>Sorry...</h3>
<p>No posts were found.</p>
  
<?php endif; ?>


please advise how I make it so that the Post Titles link to the actual posts, just like the Continue Reading links to. Thanks in advance!

i figured it out. just needed this:

<p id=“title”><a href=“<?php the_permalink(); ?>”><?php the_title(); ?></a></p>