Since I’m guessing you’re not rendering that Javascript file with PHP, you’ll need to send the ID of the post to that anonymous function using something other than PHP. You could use a data attribute in your #clickme <a>
like data-id="<?php the_ID(); ?>"
and then change your on click to:
$(document).ready(function(){
$("#clickme").on
("click", function(){ $("#myModal-" + $(this).attr('data-id')).modal();});
});
Or something similar to that.
Related Posts:
- Keyboard shortcut for updating a page or post?
- Ajax Load More Posts in Category Page
- Get the current post ID as a variable in Javascript
- How to create WP Editor using javascript
- Dynamically update post title in admin page
- Add javascript when post is published
- Get post from custom REST endpoint in Gutenberg
- Add confirmation popup on “Move to Trash”
- Create a separate JS application for an individual post?
- Convert a complex webpage into WP theme
- Add scripts on custom post add/edit pages Not Working
- Injecting JavaScript into a Post with WP3.x
- How can I get a post field value using javascript?
- Custom post preview without saving
- Block Editor: Reset Reusable Blocks to last saved record
- Ajaxify This Code
- Integrate OpenStreetMap on WordPress
- Only show a Post once in 10 visits
- In post.php how can I remove onbeforeunload?
- Navigate through the posts using keyboard arrows
- Call current post URL in ajax
- Insert specific information to a posts of a predefined category
- WordPress as CMS: How to manage/handle images assigned to a post as full-sized background images in a slideshow?
- Using the loop to set locations for all posts on a single google map
- Insert JavaScript in a blog post or a new page?
- Why is it recommended to insert JS through the theme, plugin, etc rather than in the post directly?
- WordPress React re-rendering to many times
- Ajax post doesnt call succes after got the response
- Blog Post slider not working
- Colorbox not working on native WordPress gallery when gallery is loaded thru AJAX
- testing result of $.post with json_encode
- Loading posts outside wordpress
- Front end post delete error confirmation and success message
- How to hide a script ( an ad) from a specific post? [closed]
- WP Rest API feature image breaking react component
- How can I add a custom caclulation form in post?
- How do I save JS classes being applied to the WP dashboard via custom plugin?
- How do I check if I linked to a post before I delete it?
- disable password protected page for logged users
- duplicate posts when trying to update a post using the wp_insert_post.
- Add custom field to all posts in specific category
- Hiding by default specific post status on backend list?
- “Uncaught SyntaxError: Unexpected token
- Displaying Page Title on index.php
- Using a javascript file to access a get posts array
- How can I get all posts data from within a paginated search result?
- How to automate filing a form as a user
- I want to query posts in monthly basis
- Encrypt / Decrypt Post Title and Details
- Posts vs. Pages
- Limiting the number of posts in WP_Query leads to unexpected result
- how to set beforsend option in wordpress ajax methods
- Guest Author – How to display posts on /author/ archive page
- How to add pagination in between post and comments?
- Nothing Found error when creating new posts – how to correct this?
- Redirection not working in this front end post submission form?
- Add Word Limit to Posts
- Pulling in post category and children within category
- get query() without post content?
- Custom order for Mysql array
- posts_per_page option limits the number of Gallery items
- how can i allow users to view their own pending posts in a front-end page
- Saving Post Data in Another Database
- singular posts using archive styling
- Un-highlight Blog Menu Item when Category Menu Item is Selected
- How to get the form code from the edit page of a specific post?
- Send email for pending post
- WP_Query custom field pass the post id
- Get the post id from a plugin
- Showing posts for today and future
- Display 3 posts with different HTML markup using a loop
- Moved to a new server, backup was a day old and missing 3 posts, anyway to recover them from old host?
- My post does not show up
- Set Default Post as Parent Child (Nested) Relation
- Create a List of Widgets, where each widget holds three attributes
- How to automate creating pages on a hosted wordpress from a local set of folders?
- How to fetch courses in all languages in WordPress?
- Create a tree with categories with get_posts()
- WP posts using index.php instead of single.php
- Display simple html code in post
- How to display particular set of wordpress post on a webpage?
- Center crop the feature image
- Allow users to post their videos to my wordpress website?
- Add Categories To Custom Post
- Get the category of post
- Display Posts by Categories
- Custom Single Post Type not referring to single-post-type.php File
- Problem with jQuery in post body?
- Custom template for different post types
- index.php is only displaying current month’s posts?
- prevent same wordpress post title
- Remove duplicated posts in the loop if post has more than one category
- “Current” class on a singular page menu item with custom post types?
- get next/previous post name
- Get image paths from RSS feeds
- How do I display the next 3 posts in the sidebar?
- How can to use the players from the Media Widgets in the body of a post to play audio and video files
- How can I display these posts in ascending order?
- Sort Posts Alphabetically Based on Specific Category (Divi)
- Inserting Media on New Post But Hides Previous Uploads for Editor/Contributor