Title: Make Post Excerpt Clickable
Last modified: August 3, 2022

---

# Make Post Excerpt Clickable

 *  Resolved [glenlipka](https://wordpress.org/support/users/glenlipka/)
 * (@glenlipka)
 * [3 years, 10 months ago](https://wordpress.org/support/topic/make-post-excerpt-clickable/)
 * Wordpress 6.01
    Theme: Twenty Twenty Two Goal: To make the post excerpt clickable
   Site: [https://commadot.com](https://commadot.com) Related Plugin: Twentig
 * **Summary:** I just want to make the whole post excerpt clickable. I tried installing
   TC Custom Scripts to add this:
 * $(document).ready(function($) {
    $(“.wp-block-post”).on(“click”, function() {
   location.href = $(this).find(“h2 a”).attr(“href”); }); });
 * But I got this error in incognito:
    Uncaught ReferenceError: jQuery is not defined
 * Am I doing something wrong?
    Should I enqeue jQuery in the functions of the theme?
   Is there a way to do this through the editor?
 * Thanks for the help.
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fmake-post-excerpt-clickable%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Moderator [Kathryn Presner](https://wordpress.org/support/users/zoonini/)
 * (@zoonini)
 * [3 years, 10 months ago](https://wordpress.org/support/topic/make-post-excerpt-clickable/#post-15878726)
 * Hi [@glenlipka](https://wordpress.org/support/users/glenlipka/) – may I ask where
   you got that code? If it’s older, it may not be compatible with the version of
   jQuery that ships with core.
 * Rather than JavaScript, I borrowed a PHP function from “solution 1” [found here](https://www.jemjabella.co.uk/2014/how-to-make-the-whole-wordpress-excerpt-clickable/),
   which worked perfectly on my test site. All I had to do to get it working was
   change the class name to match Twenty Twenty-Two, i.e. `wp-block-post-excerpt__excerpt`
 * I popped the code in a plugin file called `clickable-excerpts.php` and it worked
   perfectly:
 *     ```
       <?php
          /*
          Plugin Name: Wrap excerpt in a link
          Description: Adds a link around post excerpts
          Version: 1
          URL: https://wordpress.org/support/topic/make-post-excerpt-clickable/?view=all
          */
   
       function clickable_excerpt( $excerpt ) {
       	return '<a href="'. get_the_permalink() .'" class="wp-block-post-excerpt__excerpt">'. $excerpt .'</a>';
       }
       add_filter( 'get_the_excerpt', 'clickable_excerpt' );
       ```
   
 * If you want to remove the default formatting (i.e. colour & underline, etc.) 
   you can add some custom CSS as well.
 * Let me know how it goes!
 *  Thread Starter [glenlipka](https://wordpress.org/support/users/glenlipka/)
 * (@glenlipka)
 * [3 years, 10 months ago](https://wordpress.org/support/topic/make-post-excerpt-clickable/#post-15881987)
 * I ended up going a different route. I added in a cover block wrapping the H1 
   and Post Excerpt using the Stretch Link property. It would be smart for the theme
   editors to make this property available on the group block. Or just give a property
   to the post excerpt block called “Link to post”.
 * Details here: [https://commadot.com/wordpress-twenty-twenty-two-part-2/](https://commadot.com/wordpress-twenty-twenty-two-part-2/)
 *  Moderator [Kathryn Presner](https://wordpress.org/support/users/zoonini/)
 * (@zoonini)
 * [3 years, 10 months ago](https://wordpress.org/support/topic/make-post-excerpt-clickable/#post-15885031)
 * Thanks for sharing your workaround! I went ahead and put it an enhancement request
   for your idea:
 * [https://github.com/WordPress/gutenberg/issues/42935](https://github.com/WordPress/gutenberg/issues/42935)
 * Feel free to share other enhancements or report bugs there in the future. You
   have some great insights and you’re very welcome to share them directly with 
   the folks working on the editor!
 * I’ll mark this as resolved for now but feel free to post again if you need help
   with something else.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Make Post Excerpt Clickable’ is closed to new replies.

 * ![](https://i0.wp.com/themes.svn.wordpress.org/twentytwentytwo/2.1/screenshot.
   png)
 * Twenty Twenty-Two
 * [Support Threads](https://wordpress.org/support/theme/twentytwentytwo/)
 * [Active Topics](https://wordpress.org/support/theme/twentytwentytwo/active/)
 * [Unresolved Topics](https://wordpress.org/support/theme/twentytwentytwo/unresolved/)
 * [Reviews](https://wordpress.org/support/theme/twentytwentytwo/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [Kathryn Presner](https://wordpress.org/support/users/zoonini/)
 * Last activity: [3 years, 10 months ago](https://wordpress.org/support/topic/make-post-excerpt-clickable/#post-15885031)
 * Status: resolved