I have some code that I am using to display a metabox for pages: http://pastebin.com/GLukN4km. It’s working just fine…I choose a music file and it saves my choice.
Then, I have some code that uses that music file to play a background sound on that page: http://pastebin.com/D5JJQK56…which is also working.
What doesn’t seem to be working is when I choose a sound on the page I have designated for the blog. Any idea why it works for every other page but the blog page. The code that plays the sound on the page is in both page.php and index.php, so there is no issue there.
Ok, so I went through and evaluated the metabox code I was using…because, originally, I cut the code and pasted it from a tutorial I found.
Now the code looks like: http://pastebin.com/QL6TuVSv, which is much easier to read and follow 🙂
Unfortunately, I still have the same problem 🙁
What I’ve noticed is that it’s just not retrieving the metabox content if it’s on the blog page…my condition for displaying the code is returning false. When I remove the condition, the code appears, but it doesn’t get the filename from the metabox 🙁
Adding a more bizarre twist…
I created a page template using the code for my index.php page and it plays the sound just fine, for some reason if I select it as the “Posts page” under Reading, that’s when it have the issue.
What changes when you select the page as the “Posts page”?
So strange 🙂
On my page I had the following code: http://pastebin.com/D5JJQK56, which didn’t work on my blog page.
All I needed to do to fix it was use a specific page id, instead of using a global post id.
Line 2 is the only thing that changes:
The only thing I don’t like about that is if the id of my blog page changes, I have to update the code, but it works, so I’m happy 🙂
Hope this helps someone!
- The topic ‘Blog Metabox’ is closed to new replies.