I have a contribution page located here: http://pghchoralarts.org/civicrm/?page=CiviCRM&q=civicrm/contribute/transact&reset=1&id=1

I haven't gone through the entire process of testing the PayPal integration yet, but one thing I am having a bit of trouble with is figuring out how to incorporate the rest of my Wordpress theme into this page. Right now the page is an incomplete, unstyled HTML document, and I want to be able to essentially wrap my WordPress theme around it. Is there a fairly straightforward way to do this?

EDIT: I have narrowed down my issue to the fact that wp_head() in civicrm.php does not get called when it should. I have verified that CiviCRM_For_WordPress->wp_head gets added as a hook in the main wp_head(), but my theme does not call it when the main WordPress wp_head() is called. When I switch to twentyfifteen theme, the wp_head() function in civicrm.php gets called as expected. Any ideas on what may be going wrong?

3 Answers 3


Sorry, I don't have enough reputation to comment.

As Jon says, you need to go to CMS Database Integration


There you have the WordPress users table and the WordPress base page, I would suggest to create an empty page named CiviCRM - slug 'civicrm' and use that page as your base page in the menu mentioned above.

This should be the default behaviour when you install Civi, as Civi automatically creates this page and sets it as the default base page, more info about this here.

  • Thank you for the information! I did see that page, but was not sure it was the same one Jon was talking about since I assumed there would be more options available. My WordPress base page is definitely "civicrm" and the page exists here: pghchoralarts.org/civicrm However, I am not so sure that things are integrated properly due to the problem I am experiencing in my comment to Jon's post (after submitting a CiviCRM contribution form, I am sent to an unstyled page with no template included). Sep 6, 2015 at 4:32
  • 1
    Could you try to switch to the default Wordpress theme and report back?
    – Andrei
    Sep 7, 2015 at 8:21
  • 1
    You can easily create a clon of the site with the Duplicator plugin, and change the theme on the cloned site.
    – Andrei
    Sep 7, 2015 at 8:28
  • Aha! It works with the twentyfifteen theme — the link in my question is wrapped by the theme instead of being an unstyled HTML page. My theme is a child theme of an old version of roots theme, which structures files a little differently than some more conventional WP themes. Is there something in particular I should change in my page templates to get this to work? Not quite sure how CiviCRM hooks into Wordpress pages. Thanks again for your help! Sep 7, 2015 at 23:00
  • 2
    I think the way Civi hooks into the page is with the wp_head() function, you can view the source here: github.com/civicrm/civicrm-wordpress/blob/master/civicrm.php line 1010 (I'm on mobile with Octodroid, it might be different on desktop), I would suggest to enable Civi's debug and backtrace and also WordPress's debug, submit the form and check the Civi log at /wp-content/plugins/files/civicrm/ConfigAndLog. My php knowledge is very limited, but perhaps someone else here can help you.
    – Andrei
    Sep 7, 2015 at 23:56

It's easiest if you think of it as "Adding my contribution page to a WordPress page".

When editing a WordPress page, there is a CiviCRM button that allows you to insert a shortcode to insert a contribution page.

Also - it sounds like your base page isn't set. Contribution pages should inherit the default theme. Check Administer menu > System Settings > CMS Integration Options.

  • Thanks for your input! I actually did set one of those pages up here: pghchoralarts.org/test-contribute-page Aside from some CSS wonkiness, the page integrates into my theme fine. However, when I click "confirm contribution" it takes me to that unstyled page. I looked in Administer > System Settings, but don't see "CMS Integration Options" available. Do I have to enable it somehow? I'm running WP 4.3 and CiviCRM 4.6.8. Here is what I see: imgur.com/WuZpwIh Sep 5, 2015 at 0:52

I finally figured out the issue!

When CiviCRM was applying the template in civicrm.basepage.php, $page_template was coming back as page.php, but my base template was actually named base.php.

I added the following code in my theme's initialization and it resolved the issue:

add_filter( 'civicrm_basepage_template', 'psca_civicrm_basepage_template' );
function psca_civicrm_basepage_template( $template ) {
  return 'base.php';
  • 1
    Great solution. For some reason the correct method of loading a Wordpress template in CiviCRM wasn't working for me, and this fixed it, by adding in functions.php. I'd be interested in knowing what prevented CiviCRM from loading the template that was assigned to it. The page loaded with the correct template when loaded without parameters (eg example.com/civicrm but not when loaded as example.com/civicrm/?page=CiviCRM&q=civicrm/contribute/…
    – fred2
    Sep 26, 2015 at 3:27
  • 1
    Glad it worked for you! If you check out github.com/civicrm/civicrm-wordpress/blob/master/…, you will see that the function civicrm_in_wordpress_set() checks to see if the parameter page is set to CiviCRM in the URL (?page=CiviCRM). If so, it attempts to load the CiviCRM headers, templates, etc based on some other conditions. Since example.com/civicrm does not have this parameter, none of the assets are loaded and it's just loaded as a regular WordPress page. Sep 26, 2015 at 14:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.