How to get the id dynamically to store cookies

If you want the ID of the current post outside of the loop, you can use get_queried_object_id(). Just make sure to check is_singular() first, or you could end up storing IDs of things other than posts. This could cause problems if there’s overlap with post IDs. I’d share the amended code with those changes, but … Read more

Lead Generation with Cookies in WordPress

Try using the jQuery Cookie plugin You can set a cookie to start with that could be called InfoSubmitted with value of ‘No’ and when they submit their info it changes to ‘Yes’ To set the cookie first make sure jQuery and the Cookie plugin are installed and then use this: jQuery.cookie(‘InfoSubmitted’, ‘No’); Once the … Read more