Messin’ with meta
-
I’m gonna try to make a long story short. Basically, I’m working on a plugin where I can create a newsletter by placing the month and year I want the post to appear in the custom meta area. I’ve had great success with it so far, but now I’m stuck.
There are some months where the authors will not need to post, but the article still needs to appear in the new issue of the newsletter. So I need an old post to appear in both the old month *and* the new month. So far, I’m stuck on how to do this. I need it to be simple, so I wanted to be able to enter comma-separated values in the custom key, and have the script split it and then look for these as separate months, and output the info accordingly. I can get the comma-separated values in there just fine, and I’ve even managed to get the values to split (using explode). However, I can’t seem to figure out how to output the posts properly.
#1, it’s outputting the split for every single post that’s ever made. (I’m sure it’s the “foreach” that’s doing this – but I need that!) it’s outputting the test (I’m viewing the $key/$value pairs right now, to keep it simple for testing) just fine, but I have 30 posts total, and it’s outputting it – of course – 30 times. I only need them once.
#2…well, I think if I can get #1 figured out, I could get #2 figured out – which is how to get it to recognize the split data and compare it the same way I’m comparing it to everything else and making it work.
In any case, I’m stuck, and I’d appreciate a teensy bit o’ help. I’ve used pastebin so you can see my code, mess that it is. (I’m not done yet.) The highlighted portion is the part I’m asking about.
Thanks 🙂
The topic ‘Messin’ with meta’ is closed to new replies.