Cannot call WP functions inside BB, followed docs instructions…
-
Hi folks,
I have WP and BB running off the same DB, integrating users etc as far as I can tell, and each working perfectly. But, following the instructions on the docs page on how to integrate WP functions so they can be called in BB, I get errors.
I put the
require_once('www.mywebsite.com/wp-blog-header.php');
at the top of the BB config.php, in the hope that the WP functions would be discovered, but each time I try to add, say, a line to front-page.php like get_header or get_footer, to visually sandwich BB inside my WP header/footer, I get an error:Fatal error: Call to undefined function: get_header() in /home/csleary/public_html/forum/my-templates/lemodie/front-page.php on line 1
I’m very much a novice with all this, so I’m just following instructions at the moment hoping things will work. But as far as I can tell I’ve done everything correctly – please may someone offer some ideas as to what’s going wrong? While searching other integration threads, I came across one that said to make sure WP was loaded first, so BB could then load the functions, but I don’t know how to ensure this. BB is currently in siteroot/forum, and wordpress is in the root dir itself.
Any help would be fantastic, thanks.
-
Perhaps it’ll be less trouble if i just recreate the style of my WP site separately.
I think
require_once
(orrequire
,include
orinclude_once
for that matter) need a path to the file rather than a URL. A path would be like the addresses you get when you’re browsing folders on your computer. I can’t say what your path would be, but mine is/home/username/public_html/wordpress/wp-config.php
. Ask your hosting provider if you don’t know what to use.It might be easier to recreate the theme anyway, if I remember rightly a fair few folks come here with problems when trying to stick bb into the WP theme like that.
Ah – thank you for the hint, that makes sense. I’ve been tinkering with the theme to try and get it to look like the original site, but I’ll try this too, adding a path rather than URL. Thanks!
Hmm. I tried the path (it’s thrown up in the error anyway so I assume it’s the correct path!) but it’s still not working, providing me with an error.
Everything works anyway, as I built the forum theme up around the main site, but it’d be nice to know that I could call BB and WP functions if I wanted, without worrying. Oh well…
Thanks very much for the kind help though Fel64!
Found the problem – I had to chmod wp-blog-header so it could be executed. Oops!
So I can now call wp functions from bb. If I want bb functions in wp, do I just do a similar thing in wordpress?
i would like to know how to do the other way round of adding BBPRESS functions in wordpress.
i just want to add bbpress functions to wordpress what header files do i have to include where?
This?
https://bbpress.org/forums/topic/i-want-to-use-bbpress-function-on-wordpress
Most of the posts I’ve seen have been old regarding including bbPress inside WordPress.
There is this for the newer alpha versions, but it only does a couple things:
- You must be logged in to reply to this topic.