Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
0 votes
734 views
in Plugins by

Working on some pluings for Wordpress <--> Q2A ( this will be free ) and having some trouble to get relative url to Q2A's content. E.g user, question etc as the reason I found in my case is when I am including qa-base.php in WordPress it is giving below error

Question2Answer fatal error:

Could not find wp-load.php file for WordPress integration - please check QA_WORDPRESS_INTEGRATE_PATH in qa-config.php

 

Now when I checked qa-base.php than I found that WordPress path defined in the file and so when I am including the file into WordPress than system getting confused as it may considering WordPress as a Q2A root. May be I am wrong but something similar happening here.

So is there any way to get qa_path_html or any other function works in WordPress so it can consider Q2A URL structure?

1 Answer

0 votes
by

let's say you have a WP-Q2A integration. if you are developing a WP plugin then:

first require qa-base.php:
    require_once '/PATH/TO/qa-include/qa-base.php';
and if you need more inc files:
    require_once QA_INCLUDE_DIR.'ANY-FILE.php';

it will be using external codes, it is simple and flexible. but ofcourse users will need to config it's path, there is no scaping that.

if you are developing a Q2A plugin and want to use WP functions:

require_once( '/wp-load.php');
require_once( '/wp-includes/classes.php');
require_once( '/wp-includes/functions.php');

it should do the job, if you want to integrate two WP and Q2A plugins also include:

require_once( '/wp-includes/plugin.php');

 

What are you developing any way?

by
@towhid,

Thanks a lot for your help. However what I more concern about not to get WP data into Q2A ( which is in my next phase ) but currently I am trying to get few Q2A system functions into WP.
So as I mentioned when I include qa-base.php which is having url functions as well as WP path info too "QA_WORDPRESS_INTEGRATE_PATH" and it is causing the issue.

However as I understood your answers is more toward getting WP data into Q2A. please correct me if I am wrong.
by
I can't see why it shouldn't work, except if you already have a include_path. try to set your publicHTML folder with set_include_path.
set_include_path('/user/public_html');
ini_set('include_path', '/user/public_html');
it might work.
...