jeudi 26 février 2015

Get .mp3 and .ogg and put them in an array (attachments of post have separate ID)

Need some help with this. Have a feeling it's real simple but here we go. This site was not put together by me, I'm trying to add a new audio player and Ajax pagination.


I want to return all posts that have audio files. I need both the .mp3 and .ogg files and want put them in an array. Let's say like this:



[18772] (This is the post ID) => Array (
[title] => Idesia - April Love
[mp3] => http://ift.tt/1FYIp1V
[ogg] => http://ift.tt/181HVtd
)
[18770] => Array (
[title] => Another Title Post
[mp3] => http://ift.tt/1FYIp1V
[ogg] => http://ift.tt/181HVtd
)


The problem is:


I now do a foreach to get the attachments. So this happens, pretty obvious why, but each attachment has its own ID, I expect the .mp3 and .ogg file to have the same post ID?:



[18772] => Array (
[mp3] => http://ift.tt/1FYIp1V
)
[18771] => Array (
[mp3] => http://ift.tt/181HVtd
)
[18759] => Array (
[mp3] => http://ift.tt/1FYIrqu
)
[18758] => Array (
[mp3] => http://ift.tt/181HVtf
)


I hope it's clear, if not just tell me!


Thanks in advance.


Aucun commentaire:

Enregistrer un commentaire