Installing Question2Answer with WordPress integration
From version 1.4, Question2Answer offers out-of-the-box integration with your WordPress 3+ site and user database. To install Question2Answer as part of your WordPress site, please follow the instructions below:
-
Download the latest version of Question2Answer to your computer or web server (also available on GitHub).
-
Unzip the download using a tool such as WinZip (or
unzip
in the Unix shell). -
Find
qa-config-example.php
and.htaccess-example
in the unzippedquestion2answer
folder, and rename them toqa-config.php
and.htaccess
, respectively. -
Open
qa-config.php
in a text editor and insert the following line next to anotherdefine(...)
in the file:define('QA_WORDPRESS_INTEGRATE_PATH', '/PATH/TO/WORDPRESS');
Replace
/PATH/TO/WORDPRESS
in the example with the full path to the WordPress directory on your server, i.e. the directory which containswp-load.php
. You do not need to set your MySQL database details inqa-config.php
since these are imported from WordPress automatically. Q2A and WordPress will use separate tables within the same MySQL database. -
Place all the Question2Answer files in the appropriate location on your web server:
- To serve Question2Answer in a subdirectory of a site (e.g.
http://www.mysite.com/qa/
), create the subdirectory inside the root directory for the site, then move or upload all the contents of the unzippedquestion2answer
folder into this subdirectory. - To serve Question2Answer at the root of a domain (e.g.
http://qa.mysite.com/
), move or upload all the contents of the unzippedquestion2answer
folder into the root directory for that domain on your web server.
- To serve Question2Answer in a subdirectory of a site (e.g.
-
Ensure that WordPress authentication cookies and redirections are compatible with Question2Answer, as follows:
-
If Question2Answer is in a subdirectory of your WordPress site (e.g.
http://www.mysite.com/qa/
underhttp://www.mysite.com/
) then nothing needs to be done. -
If Question2Answer is on the same domain but not in a subdirectory (e.g.
http://www.mysite.com/qa/
andhttp://www.mysite.com/blog/
), then add the following line at the start of the WordPresswp-config.php
file:define('COOKIEPATH', '/');
-
If Question2Answer is on a different subdomain from your WordPress site (e.g.
http://qa.mysite.com/
andhttp://blog.mysite.com/
) then it's a little more complicated. First add the following lines at the start of the WordPresswp-config.php
file, replacing.mysite.com
with a period (.) followed by the partial domain name which is shared by both sites:define('COOKIEPATH', '/'); define('COOKIE_DOMAIN', '.mysite.com');
Then add the following lines at the end of the WordPress
wp-config.php
file, replacingqa.mysite.com
with the full domain name for your Q2A site:/* To allow redirection from WordPress login to Question2Answer */ add_filter('allowed_redirect_hosts', 'qa_wordpress_redirect_hosts'); function qa_wordpress_redirect_hosts($content) { $content[] = 'qa.mysite.com'; return $content; }
-
-
Open the appropriate web page for Question2Answer in your web browser, for example:
- If you installed Question2Answer in a subdirectory,
http://www.mysite.com/qa/
- If you installed Question2Answer at the root of a domain,
http://qa.mysite.com/
- If you installed Question2Answer in a subdirectory,
-
Follow the on-screen instructions to set up your database and Question2Answer functionality.
-
You can now integrate the styling of Question2Answer with your WordPress site by creating a Question2Answer theme.