![]() |
|
Thread Tools |
#1
|
||||||||
|
||||||||
Wordpress Header & Footer Integation
Hello,
I'm trying to integrate vBulletin 5.0.x with Wordpress. Specifically, I'm trying to add the WordPress header and footer to show in vBulletin using Wordpress's functions get_header() and get_footer() that come from the file wp-blog-header.php in the WordPress installation folder. So I'm trying to figure out the following: 1) require the wp-blog-header.php file somewhere for vbulletin to use using require() 2) to figure out where to insert the php functions get_header() and get_footer() I looked at this post: http://www.vbulletin.org/forum/showthread.php?t=298770 and it gave some information on making an extension by adding a folder to the /core/packages folder and putting a class file there with a custom function that I could use in a template, but I couldn't find much information on how to create a product xml file. It seems important to do this because I can't register my extension in the Admin CP -> Products & Hooks -> Manage Products -> Add/Import Product without it. I'm don't need to create hooks or templates, and this product I'm creating doesn't need any custom html. Here's the code I wrote so far:
I added these lines to the /core/global.php file because I couldn't figure out where to put a php require statement:
So any help would be greatly appreciated - I couldn't find any docs on doing this after 6+ hours of searching. No members have liked this post.
|
#2
|
||||
|
||||
You don't need a product xml. All you need is an extension and a product. The extension will show up without a product.xml. Once it shows up you can add a product for that extension manually in the AdminCP.
The extension is basically a .php file inside the packages/yourextensionname/api/ directory.
Put this into packages/wpheaderfooter/api/options.php Not tested, but should work. No members have liked this post.
Last edited by marco_kellershoff; 15 Sep 2013 at 11:43. |
#3
|
||||
|
||||
Thank you for such a quick reply! I got the extension successfully registered.
Is this how I run the function in a template?:
(not sure about the varname "wp") - I put this in but nothing shows up in the header template. Also, do I need to register this as a product in the AdminCP import/add product page for this to work, or is just registering the extension good enough? Thanks again! No members have liked this post.
|
#4
|
||||||||||||
|
||||||||||||
I'm not familiar with wordpress, so I don't really know what wpHeader() is doing.
If it is just returning the header html like so:
then you need to alter the extension's code a bit like this:
(now the function returns the value) and then in your template you do something like this:
the first line just assigns the data and the second ones echos it ![]() --------------- Added 15 Sep 2013 at 12:54 --------------- You might also want to read about this related topic here: http://stackoverflow.com/questions/1...-a-text-string No members have liked this post.
Last edited by marco_kellershoff; 15 Sep 2013 at 12:53. |
#5
|
||||||||
|
||||||||
Ok, I feel like I'm so close, but missing something. Here is my new extension class file so far. I simplified it just to get it to work at all:
And here is my new template markup (using the header template), which I inserted around line 114 (shortly after the <body> opening tag):
Also, you mentioned I need that I need to manually add the product. I did so in the AdminCP ->Products & Hooks -> Manage Products -> Add/Import Product, Add Product section. Here I just gave the Product id text field the same name as $product variable I used in my class above: 'wpheaderfooter' . I do have the options -> Products/Hook System enabled (set to yes). However, I get no output. Thanks so much for your patience in helping me. Hopefully I'm just missing something simple. No members have liked this post.
|
#6
|
||||
|
||||
Just try to add a hook - then it should work
![]()
__________________
I'm a full time developer working for gofeminin.de and I love to share my thoughts with you. ![]() No members have liked this post.
|
#7
|
||||
|
||||
Ok, I pulled my {vb:raw} code out of the header template and made a new template, "wp_header_footer" and put it in there:
Then I created a new hook.
The html I put in the template shows up (h2 and h1), but the {vb:raw wphead} does not. The thing I am bit worried about is that when I created a new Product ("WP Header and Footer"), I didn't have any way I could see to link it to my wpHeaderFooter_Api_Options class listed in the extensions. Am I missing a step? No members have liked this post.
Last edited by jdorsey; 16 Sep 2013 at 01:35. |
#8
|
||||||||
|
||||||||
If you can wait until tommorow, I'll write you a detailed, step by step guide, including (working) source code and screenshots.
It's just that today we have planned a relaunch of one of our mayor sites ![]() But please, don't get angry or sad - I know the vBulletin software is lacking good docs, which is really sad - I fiddled around about 2 full 8h workdays to understand how the new extension system in vB5 works - it's a shame. I'll come back to you tomorrow, k? --------------- Added 16 Sep 2013 at 13:08 ---------------
Originally Posted by jdorsey
![]()
I'm really sorry for such misleading information ... must have been a lack of sleep & coffee on my side..
it has to be options, because you are simply extending the options api from vbulletin..
__________________
I'm a full time developer working for gofeminin.de and I love to share my thoughts with you. ![]() No members have liked this post.
|
#9
|
|||
|
|||
That worked! I replaced wpHeaderFooter_Api_Options with options, and it now works. Thanks so much! Hopefully the rest is just php stuff and not vbulletin related. I may post how I actually completed the whole thing in a little tutorial for posterity. And that would be great if you could post a little tutorial for how to make a hello world extension. If you're like me, I know you must be very busy though.
No members have liked this post.
|
#10
|
||||
|
||||
Just posting briefly as I'm interested in this too, and have far less php knowledge!
![]() When I get this right, will it also add the wordpress top menu, or is that another problem to solve? A tutorial would benefit me immensely, thank you. No members have liked this post.
Last edited by moonclamp; 02 Oct 2013 at 00:31. |
#11
|
||||
|
||||
Just giving this a gentle bump
![]() No members have liked this post.
|
#12
|
|||
|
|||
I would love to actually see this as something here on vbulletin.org.
No members have liked this post.
|
#13
|
|||
|
|||
Any success?
No members have liked this post.
|
#14
|
||||
|
||||
I would love a tutorial please
![]() No members have liked this post.
|
#15
|
|||
|
|||
I would love one, too. I'm definitely missing something. =(
No members have liked this post.
|
![]() |
«
Previous Thread
|
Next Thread
»
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
|
|
New To Site? | Need Help? |
All times are GMT. The time now is 00:34.