• Resolved joshrodgers

    (@joshrodgers)


    I have some code that I am using to display a metabox for pages: https://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: https://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.

    Any ideas?

    Thanks,
    Josh

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter joshrodgers

    (@joshrodgers)

    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: https://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 ??

    hmmmm……..

    Any ideas?

    Josh

    Thread Starter joshrodgers

    (@joshrodgers)

    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 ??

    Thanks,
    Josh

    Thread Starter joshrodgers

    (@joshrodgers)

    Mission accomplished!!

    On my page I had the following code: https://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:

    https://pastebin.com/D5JJQK56 becomes https://pastebin.com/nyxSdtR0 (just replace 17 with the id of your blog page).

    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!

    Josh

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Blog Metabox’ is closed to new replies.