I have created two plugins. Plugin A gets the latest posts, all of them. It has an option that can remove posts by entering their ID, this is accessible via the shortcode or directly in functions.php. This works.
Plugin B gets the most popular posts using an internal analytics systems. I have a variable called $most_popular_ids which contains all of the post ID's of the highest viewed posts for that particular category. So $most_popular_ids changes depending on which page it is on. This works.
These are displayed side by side on the main pages of the website. So ideally I would like them to not show duplicate posts.
What I finally need to do is pass $most_popular_ids from plugin B to plugin A or to functions.php. This will allow me to exclude all of the most popular posts from the latest posts.
Obviously making the variable global only works in the scope of the file so that won't work. I tried creating a $_SESSION but you can't do that in Wordpress as far as I know. Most of the stuff in the plugins can't be redeclared so my include attempts didn't work either :\
Can anyone help me?