Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.

can you call wordpress functions in qa-theme.php?

+1 vote
81 views
asked Mar 20 in Themes by LTech
I would like to use my wordpress header and footer for the q2a pages. I've been going to 'view source' and copying and pasting the code in to qa-theme.php but it isn't working b/c I have widgets in my footer which have a lot of code eg facebook login, social share.. .

Is there a way to just call get_footer and get_header in the qa-theme..php file.?

What is the best way to integrate the theme with my site's wordpress theme?

1 Answer

+2 votes
answered Mar 20 by sama55
selected Mar 21 by LTech
 
Best answer

I have created a similar site. At that time, main-site was MODX and sub-site was WP. Basic processing will be as follows.

  1. Make new theme layer plugin
  2. Require wp-load.php at the beginning of the plugin
    wp-load.php is the same as qa-base.php in Q2A. You can call WP functions from external system by including this file.
  3. Override the appropriate layer function (style, header, footer, etc)
  4. Call WP function (wp_header, wp_footer) from overridden function

It will not be enough to just include WP header and footer HTML in Q2A. You will need to include also WP stylesheets. WP stylesheets will conflict with Q2A stylesheets. You can avoid this conflict by devising Q2A style. However, knowledge of style sheet is necessary for this work.

commented Mar 21 by LTech
edited Mar 21 by LTech
I created a new css stylesheet in my wordpress theme for q2a and added it in wp_enqueue_style in functions.php. This worked perfectly. Thank you so much. This is a great wordpress theme integration.
...