Info
- 3 posts
- 2 voices
- Started 3 years ago by TechGnome
- Latest reply from chrishajer
- This topic is resolved
Creating custom pages creates havoc
-
- Posted 3 years ago #
I'm not sure if this is a rant, a request for help, or a general gripe.
I want to replace the default front page with something else. I'm building a website for an online radio station, and when visitors first hit the site, I want them to see current info, like what's playing, what's up next, and the last few that played. From there, there would also be a "Listener Forums" link that would take them to another page that would be the forums' front page.
Trying to be smart about it, I took index.php from the root, copied it, and renamed it "forums.php". Then I went into the template, copied front-page.php and renamed the copy "station.php". So far, so good. Then things went wrong from there.
Back at the root, I opened the index.php and changed it to call station.php instead of front-page.php. I then went to my website, and made sure that index.php was still working, which it was. Again, so far, so good. At this point station.php and front-page.php are exactly the same, as are index.php and station.php, with the one exception. But I should still get the exact same thing from both index.php and forums.php (or so I thought). When I visited the forums.php of my site.... I noticed it was..... off... and not a little, the layout as a whole was jacked with very little in the wrong place.
Careful scrutiny of the source for both pages led me to find out that on the forums.php version, I was missing the ID off of my body tag. Eh? I finally found the location in the bbPress file that returns the body id.... and sure enough.... because my "file" doesn't fit into the list... I'm not getting a body id.... well, this isn't very flexible. My first thought was to create my own version and include it in my functions file.... but that's hardly a solution.
So, am I stuck? Do I need to consider something else? How do I get around this? I've got other files I will be adding to my site like this... so this is just the first of several times this is going to happen to me. I'm just glad that I didn't fully finish the plugin I was working on. I would hate to have wasted my time on something that I can't use.
annoyed and frustrated,
-tg -
- Posted 3 years ago #
Well smother me with some butter and call me a biscuit! I figured it out. I mis-read how the get_location function works. The answer to my problem was to add a filter like so:
add_filter( 'bb_get_location', 'my_set_forums_location' );And then add a function thusly:
function my_set_forums_location () { return 'front-page'; }to my new forums.php file... and viola! Everything worked like it should! Woot!
-
- Posted 3 years ago #
Would this tip have helped?
http://bbpress.org/forums/topic/heres-how-to-use-bbpress-outside-the-bbpress-directory -
You must log in to post.