Using the_id outside of single.php
-
I’ve been trying to find a way to pass the_id variable through my external links in order to track which clicks come from which post, but I’m having trouble making it work properly.
Using the Template Tag Shortcodes plugin, I’m able append the post id to the end of my url as such:
https://www.example.com/?kw=%5Bthe_ID%5D
The problem is that I’ve been unable to make this work for ads that are placed in the sidebar or other locations.
I figured this was due to the fact that the posts are actually a collection of PHP files, like single.php, sidebar.php, header.php, etc., but it seems like there should be a way to use the post id outside of the single.php file (in a widget on the sidebar, for example).
Anyone have suggestions how to make this work?
- The topic ‘Using the_id outside of single.php’ is closed to new replies.