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
- Related Posts by Multiple Tags?
- Custom SQL query to get List of posts with featured image url
- Get taxonomy name of current post
- Create single.php for specific category by category id
- Display “Post 2 of 4” on single post page?
- if is_singular array not working as expected
- Why use while over if in single wordpress posts?
- Pagination for custom query on single.php
- Make custom post type display as a page
- Enable infinite scroll on single.php [closed]
- Do not show excerpt in post content
- How to check the terms in single custom post type template
- How to show the archive / post type description on Single templates
- Link for Most Recent Post
- Can’t get the_content of the parent page from its single post?
- How to show single post page as home page
- Single Page Design, Storing in Theme Options
- How to convert multi-site to single site
- previous/next_post_link in the same sub-category?
- If in_category not working for multiple single.php pages
- Modified loop-single-forum.php to work inside of a sidebar Widget, not working on some site pages
- Not Able To Render Single-CustomPostType.php File
- Single.php – Get Current Parent Category
- WordPress block editor embeds not working in theme (single.php)
- Pagination on Single Post
- Is_single() conditional tag returns null in query
- Single.php different behaviour from admin to non-admin
- Associate page w/ specific single post template?
- Single Post in Tab/Slider
- Problems with my conditionals in single.php by category
- Can’t access private custom posttype single- or archives-page
- Creating php pages in wordpress and assigning them to wordpress pages
- Load different single.php templates according to post layout selection
- Redirect after post deleted
- wp_query issue with post_type = page
- How can I check which archive has referred the single? [closed]
- I would like single.php to act just like index.php
- Changing wp_link_pages() to “Next Page” and “Previous Page” buttons?
- Making a wordpress page print friendly
- Function to allow single post template based on custom taxonomy?
- “Home” Page now only displaying the single latest post
- WordPress giving me the index
- Hide/exclude certain tags under single post
- WP posts using index.php instead of single.php
- Single post shows post three times
- LinkedIn Share Post Button
- Assign for all post of a post type a specific single-post template
- Creating a Back button on detail post page to go back to blog page with same query strings and page id
- Making permalink for custom post type/custom taxonomy. Stuck with 404 in the single post
- Create single{custom}.php with data in table out of wp_posts
- Edit single page from plugin
- Get the category of post
- Custom Single Post Type not referring to single-post-type.php File
- WP_Query shows all posts on single post pages
- Code to display category-specific single.php is overriding normal single.php, too
- Content-single.php inside my plugin
- Comment text area in single blog post and show comments if approved
- Display Referring Category on single post?
- Modify / Rewrite single template url structure
- single.php doesn’t getting style
- Get current post’s child page?
- Custom Style per Post, How to Display Custom-Styled Single post on Homepage?
- Single template will not show sidebar/bottom-nav and footer
- How to display before H1 Title