The href
attribute you are passing under the_post_thumbnail()
is incorrect. Note that this attribute is applied to the img
tag which obviously doesn’t supports href
attribute.
It would be better to wrap the_post_thumbnail()
with an <a>
tag. So it will look something like the following:
echo '<a href="' . get_permalink( $thumbnail->ID ) . '">' . get_the_post_thumbnail( $post->ID, 'thumbnail', array( 'class' => 'group1 img-responsive' ) ) . '</a>';
Related Posts:
- Get the blog page URL set in Options
- The the_post_thumbnail without srcset?
- Get the first image from post content (eg.: hotlinked images)
- How to set permalink structure via functions.php
- Different ways to display title
- How to add a 2nd “featured image” to a post?
- How Do I Programmatically Force Custom Permalinks with My Theme?
- How to change post thumbnail title and alt attributes to post title?
- Unexpected width and srcset attributes for the_post_thumbnail();
- How to handle thumbnails
- Change display of featured image for pages in twenty seventeen theme
- How to set dimensions of the post thumbnails (featured images)
- How to regenerate thumbnails when they’re stored on S3
- Cannot get full thumbnail size using the_post_thumbnail
- Link won’t show using the_permalink();
- get_query_var() and permalinks
- Can’t show custom post thumbnail sizes as background images
- WordPress custom post type permalink: website.com/post-name/post-id
- Featured Images are not able to be set
- Display recent posts with thumbnail
- Reasons why all thumbnail sizes aren’t working
- How do I Add images uploaded in the post to a default custom field
- How do I build a post_thumbnail based archive? [closed]
- Filter categories used with Custom Structure Permalink
- How do I turn a post thumbnail into a background image?
- Reactor Theme: Prevent Post Thumb on Post
- How to make permalinks update from code?
- Default Permalink Type to Postname
- How to set a page as homepage in stead of the newspages?
- Featured Image meta box not showing up
- How do I remove inline style in featured image markup?
- Set a featured image as a replacement to the header image
- wordpress 404 not found after rewrtie the author link
- Dynamic Post Thumbnail →
- Issue On Displaying Pages with Post Name Permalink
- How To Pick Custom Size Of Uploaded Image In Theme Via the_post_thumbnail();?
- WordPress page/blog incorporated into static website
- How to disable thumbnail filter for a specific template part or image size?
- the_post_thumbnail() get the URL to the “medium” sized image
- Full width featured thumbnail
- Only the latest post shows up on post page?
- How to remove permalinks links presents in each page of my site?
- How can I get the featured image or the first image for a post/page and display it as a banner?
- How to make excerpt image be full size instead of thumbnail?
- How can I scale down the width of images in bulk that are embedded in posts throughout the site?
- Add image URL automatically to custom field?
- If I remove Category base from my URLs, how difficult will rollback be?
- What are the permalinks options for “Category” base and removing it?
- theme directory fallback image outputs url and not the image
- How do I open a post in a custom page in wordpress?
- Does single webpage do not need navigation to create a slug in permalink?
- Getting post URL within custom content template
- Created blank theme for REST API, featured image not appearing on admin side
- Full width thumbnail
- Featured Image Module Randomly Disappears
- Single Featured Image Repeating
- Any disadvandages if I style the wordpress align classes without img and .wp-caption prefix
- apply_filters to featured image
- Mamp pro permalink issues. Pages keep reverting to index.php
- Show post thumbnail only if it exists using timthumb
- Display Page featured Image as well as Posts featured Image
- Permalinks problem with custom theme
- Permalink Setting Changes From Post Name to Default After Changing The Page Name
- Configuring static page with add_rewrite_rule gives 404 after navigating to Permalinks admin panel
- How do I work with responsive images in WordPress? (img srcset/sizes)
- I want to resize post featured image without cropping image. How?
- WP “optimizing” PNGs into thumbnails 5X larger than originals – FIX
- optimized PNGs 5X larger than originals
- Menu items description? Custom Walker for wp_nav_menu()
- How to define and link full path to css located at a random folder on header.php
- Sizing screenshot.png without losing aspect ratio
- Software for WordPress Theme and Plugin Development? [closed]
- When to use is_home() vs is_front_page()?
- What is the preferred way to add custom javascript files to the site?
- How to create .pot files with POedit?
- How do I get the theme URL in PHP?
- Why when I submit a form in wordpress it loads a 404 page though URL is correct
- What is the constant WP_USE_THEMES for?
- Worthwhile to restrict direct access of theme files?
- How Do I Protect My Premium WordPress App Theme from Copying?
- How to detect mobile devices and present them a specific theme?
- Using wp_add_inline_style without a stylesheet
- How to add posts to custom menus?
- WordPress Theme Preview Image
- How To extend WP_Customize_Control
- What is the difference between front-page.php and home.php? [duplicate]
- How can I get page slug
- Does the functions.php file ever get called during an AJAX call? Debug AJAX
- When to use _e and __ for the translation?
- What is a Theme textdomain?
- How to show a custom meta box on the “Quick Edit” screen?
- How to add CSS class to custom logo?
- How to add custom css file in theme?
- How important is it to enqueue a theme’s stylesheet?
- CSS not updating in browser when I change it
- Display Search Result Count
- wp_nav_menu(), how to change class?
- theme path in javascript file
- Is wp_is_mobile() effective?
- Display Menu Name using wp_nav_menu