Problem is here:
<div id="my-video" style="display:none;">
as you can see, id is static and is the same for all posts. First of all this is not compliant with html standard: tag id must be unique.
As a side effect if you use the id selector in jquery and the id is used a lot of times jquery apply function a lot of times…
So first you have to make id unique, in the loop use:
<div id="my-video-<?php the_ID(); ?>" class="my-video-container" style="display:none;">
For same reason change the code for the play button (you can remove imageID at all):
<a class="video-play-button" href="#"></a>
and change jquery like so:
$('.video-play-button').click(function() {
$(this).closest('.feature-img').find('.my-video-container').show();
$(this).siblings('.featimg').hide();
$(this).hide();
});
Related Posts:
- The correct way to call posts with ajax
- add bootstrap post slider with tabs
- Using the loop to set locations for all posts on a single google map
- How set featured posts using checkbox in post edit screen?
- Do we still need to include a “if (have_posts())” in templates?
- Query *only* sticky posts
- Dynamically update post title in admin page
- How to load post content on index page using ajax when post title in sidebar is clicked
- Cannot access current post’s ID in custom plugin
- Can’t show comments count per post outside loop
- Show a list of recently viewed posts to a user
- Alternate custom content in the loop
- Showing random content / pictures from earlier posts in a sticky post?
- “Uncaught SyntaxError: Unexpected token
- Auto Refresh Post List after X seconds
- Display posts with comments closed, with pagination?
- How to create a load more post entries like Twitter?
- Related posts loop based on tags AND categories doesn’t work without at least one tag assigned
- jQuery inluclude still seems ncessary for script to work within post
- How To Get Posts With A Specific Word
- WP_Query with ajax handler returns the same posts
- How to display posts on a static page? (like search loop)
- Why WP_Query(‘showposts=5’) shows only 1 post?
- Displaying Latest Posts on a Page
- Display all posts that were published before full post on single.php
- WordPress Loop – Next 3 Posts
- problems with loading posts in a table-row
- Blog page pagination is not working after using the offset argument
- WP Query – Posts Per Page not working in combination with category__in
- More then one menu items are assigned with “current-menu-item” class
- Pulling in post category and children within category
- How to add tags (custom taxonomy) to post class css?
- Listing Specific Categories from Current Post with Depth
- How to exclude visited posts from loop
- Only display sticky post or latest post in custom loop
- get_the_category listing in hierarchial order
- Do all wordpress themes a similar class name for content?
- Exclude current custom post on single post
- add to end of post in the loop with plugin
- Grid post page on WordPress with Bootstrap, the_excerpt(); Problem
- Loop parent terms {display posts} AND loop child terms {display posts}
- Custom taxonomy archive page problem
- Loop don’t work within single.php page
- Add Blog to WP homepage Manually
- How to show all posts by author on buddypress profile with navigation
- ACF to select posts not displaying on blog page
- Getting blog pagination to work on page set as front page
- Make loop inside slider divisible [closed]
- How to add automatically bootstrap 4 order-lg-1 and order-lg-2 classes for columns in foreach loop based on the count?
- separate the post of a category by subcategory
- How to display post list in a table layout (multiple queries in single loop)
- Not all posts showing in query
- WordPress loop not working on static front page
- Optimize CPT-function with a loop
- The loop starting at a certain ID
- Limiting the amount of posts retrieved by the loop
- Display 3 posts with different HTML markup using a loop
- Changing wp_link_pages() to “Next Page” and “Previous Page” buttons?
- How to repeat a loop after 4 posts [duplicate]
- How to separate each individual blog post?
- Error while excluding a post from another loop (using its ID)
- Is there a way to define the $post var outside the loop?
- Only the most recent post is showing on my category page (working on localhost, not live site)
- Diffrent layout for posts [duplicate]
- show loop id post , only first id can read
- Can I Paginate Post after every 25 tag?
- Alternative content between posts no repetition
- Start loop from specific post ID
- Display new posts categories in separated divs
- Show post excerpt
- Wp_query loop is not working as it should
- Maximum number of posts per page before affecting performance?
- Display post order ranking within wordpress loop
- Problem with wp_insert_post()
- How to control Post view count incresing in sidebar widget posts too?
- WordPress loop uses unmodified posts array, why?
- Add row after three columns
- Modify WordPress loop after it has been run
- Skip posts, but keep posts per page
- Multiple Post Repeat for Related Post Loop by Category
- Problem with jQuery in post body?
- index.php is only displaying current month’s posts?
- Loop doesn’t display posts. It displays a link to the home page instead
- WP Load post with ajax and apply isotope
- Run Jquery Script after delete post in front end
- Grab next post title in archive page
- Where should get_post_meta() go to get $post->ID get_post_meta() is empty and $post->ID & get_the_id() are working
- Getting posts from multiple users?
- Loop through posts by each term and exclude duplicate posts assigned to several terms
- Show post if in category
- Displaying categories items among posts
- Only show posts with image and the correct ammount of posts in loop
- Related posts by searching post tags of single post as terms
- jquery: getting contents of #content field on post page
- Show all posts in category
- First post in loop displays twice
- Wrap every 2 posts
- Full width images within post content
- What function does the loop of displaying posts?
- What template file is used by default for posts?