Hiding posts with custom solution, need multiple array from SQL
-
I took WP Favorite Posts, and reversed it so that it can be used as a “Hated” posts.
I then added:
style="display:<?php if (function_exists('wphp_txt')) { wphp_txt(); } ?>;"
to each individual div in the loop, and changed the “hated” text (what it says when something is “hated”) to hidden so that when someone clicks on the Hide this link it makes the div become hidden, no longer showing up.
The functionality is still the same from the original plugin, so the value is stored as such:
a:1:{i:0;s:5:"43247";}
in the database/cookie.
Now, while this works for my purposes, I want to take it a step further and instead of simply hiding a post by hiding the div, I want to incorporate some sort of continue function so that it not only hides the post, it skips it altogether in the loop, keeping the loop in-tact and showing the post directly after that.
So it would be like this:
Post 1
Post 2
Post 3
–next page–
Post 4
Post 5Person hides Post 3, for example, so the new loop looks like this:
Post 1
Post 2
Post 4
–next page–
Post 5
Post 6Now, since it stores it like it does (a:1:{i:0;s:5:”43247″;}) I can’t simply echo the MYSQL value because it doesn’t just store a simple post id (multiple hates looks like: a:2:{i:0;s:5:”43247″;i:1;s:5:”43246″;}, or a:3:{i:0;s:5:”43247″;i:1;s:5:”43246″;i:2;s:5:”43248″;}.
So is there a way to strip out everything but the individual post IDs from this, and then echo those IDs into a continue function?
You can see it in action here.
- The topic ‘Hiding posts with custom solution, need multiple array from SQL’ is closed to new replies.