That is not the way functions work. You can’t tack part of an if/else
query onto the end of a function… at least that kinda looks like what you are doing. Or maybe you’re are trying to us an else
without the if
… Anyway, the syntax is badly broken.
Here is a cleaned up version that should do what you intended your function to do (I think).
//wraps the permalink around each thumbnail
add_filter( 'post_thumbnail_html', 'my_post_image_html', 10, 3 );
function my_post_image_html( $html, $post_id, $post_image_id ) {
if(!is_single()) {
$html="<a href="".get_permalink($post_id).'" title="'.esc_attr( get_post_field('post_title',$post_id)).'">'.$html.'</a>';
}
return $html;
}
Related Posts:
- Is it possible to use a single custom post as the site front page
- Listing a post’s categories and subcategories
- Single post comment template not working
- How do I show google ads between post content?
- Add inline style to get_the_category_list
- Help with figuring out the future post workaround
- Disable single view for specific post category
- Only nextpagelink on wp_link_pages
- Display a post map on a blank/new page
- How To Pass Current Post Type ID from Single Template To Custom Page Template
- Is it possible to create rel=”noindex, nofollow” for a single post if contain bad keywords?
- Custom seperate Single.php
- Set a cookie only in single posts
- Custom post type not respecting template hierarchy
- diffrent style for post single page
- WordPress object for comments frame [closed]
- I’m having a problem viewing the Youtube video
- Use different «Single.php» for custom categories
- force https except one page/post
- Single custom post type template not working (single-custom_post_template.php) not working
- Single.php category entries not showing right colours
- Link from archive-page.php to single-page.php
- How to check if a post is in categories x,y,z inludint their subcategories
- Changing the display of the themename_posted_on() function
- How to Highlight current category on category and single page template?
- WordPress, alternative single post template
- get full real path of thumbnail post img wordpress
- how to loop through this in blog single?
- Modify post template on Divi Theme
- I want to signin from first wordpress site to other wordpress website without registration..without using network mode
- Try to showing product file size on product single page
- Improve related posts
- Get active term on single (CPT) page
- Having single posts appear under the blog homepage and highlight menu items properly?
- Single.php loading fully on localhost but not on server
- explain why is_single doesn’t work
- How to disable the single view for a custom post type?
- How to check if the product is in a certain category on a single-product.php in Woocommerce?
- Custom post type single page returns 404 error
- Custom post type single-{custom}.php not working
- What is singular.php?
- How to detect single.php (but not single-portfolio.php)?
- Conditional for single-{post-type}.php
- Check IF is a “single product page” and Check the “role” for a Redirect
- How to modify single.php in a child theme?
- Add_action to wp_head via functions.php
- Custom Single Post By Category
- Using single.php from plugin folder instead of default template folder
- Template for specific post of custom post type
- How do I get the category URL from get_the_category?
- Custom permalink structure only for default posts
- Related Posts by Multiple Tags?
- Single custom post type page redirecting to 404 page
- A special single page templates for posts under a category and all its child category
- How do I create a link that will always show the latest post?
- Posts in multiple Categories different single.php
- Pre get posts for single post
- Pull Two Posts Into Custom Post Type `single-cpt.php`
- Custom SQL query to get List of posts with featured image url
- single page wordpress
- Get taxonomy name of current post
- is_singular() not working if called via callback function of admin-ajax.php
- Disable Single Post View for Specific Taxonomy on Custom Post Type
- the_post_thumbnail() based on the Post ID
- How do I create a widget that only allows a single instance?
- How to get a list of term names of the custom post type im currently on in single.php
- Post X of Y in single.php / sidebar.php
- HTML code in Custom field
- is_singular won’t call my functions?
- How to show a post single post in page template
- Proper way to load a single post via Ajax?
- Create sub single pages
- Using previous_post_link and next_post_link to wrap around post sequence
- Multiple Single Installs of WordPress with a central user base
- How do I create new content pages for my Custom Post Type?
- How to have different content in the loop and single
- Create single.php for specific category by category id
- Single.php Active Category Class
- Display “Post 2 of 4” on single post page?
- posts_nav_link on single post template
- How do I create a single.php for a specific category?
- Functions.php: If its single?
- Problem getting single_template filter to work – I want to serve a different single.php file for posts in a certain category
- Post Rank on Single Post page based on custom field
- Disable single pages and archives and keep preview
- WordPress Single Conditional for Search Page
- Problem with single-page for my custom post
- Possible to paginate on single.php?
- Show single post then all posts (with pagination)
- Insert After Second Paragraph Without Tag?
- Displaying Meta Box Image
- Display Single Attachment Image file size, uploaded date, resolution, file-name etc in Sidebar
- if post id matches these id’s then do this
- if is_singular array not working as expected
- How to add shortcode tags in single.php [closed]
- Why use while over if in single wordpress posts?
- How to get category id in single.php wordpress?
- Pagination for custom query on single.php
- get_terms parent for current product only
- Custom template for post type not working