CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • Wordpress + CiviCRM Developer Resources
Pages: [1]

Author Topic: Wordpress + CiviCRM Developer Resources  (Read 1783 times)

CiviTeacher.com

  • I live on this forum
  • *****
  • Posts: 1282
  • Karma: 118
    • CiviTeacher
  • CiviCRM version: 3.4 - 4.5
  • CMS version: Drupal 6&7, Wordpress
  • MySQL version: 5.1 - 5.5
  • PHP version: 5.2 - 5.4
Wordpress + CiviCRM Developer Resources
April 05, 2012, 05:08:17 pm
CiviCRM 4.1 integrates with Wordpress 3.3.1 as a plugin.  Earlier versions of either software will not work.  Upgrade Wordpress before attempting to install CiviCRM as a plugin and read the documentation on installing.

Here are a list of links that will help you get started building custom stuff for Wordpress and CiviCRM integrations.

THIS PAGE HAS BEEN MOVED TO THE WIKI. 
When this information becomes more complete and expanded I will move it to the Wiki.  You may still ask support questions here, although...you should be warned that my own experience integrating Wordpress and CiviCRM is limited.   I probably will not be able to answer your questions with any degree of certainty.

General Knowledge

1. Wordpress sites use 'themes' much like Drupal themes or Joomla templates.  There is a well developed theme system for Wordpress.
2. Wordpress 'plugins' are the equivalent of Drupal modules or Joomla components.
3. Wordpress 'widgets' are the rough equivalent of Drupal blocks or Joomla extensions (I think).  There are many types of widgets, and some plugins make additional widgets types available.
4. Wordpress has a default batch of roles, and the permissioning system is not as fully developed as Drupal's.  Currently CiviCRM gives 'all' permissions to the top few Wordpress roles.  We might change this in 4.2.  Plugins exist to extend Wordpress' permission and role system.  CiviCRM doesn't yet integrate with these plugins.
5. There is no Wordpress equivalent of 'Views', although X-Data Toolkit exists as a potential way to grab data from the CiviCRM dB (or other sources) and show the data within Wordpress.

Using the CiviCRM API with Wordpress

Wordpress requires plugins to execute PHP code within pages, posts, and widgets.
  http://wordpress.org/extend/plugins/php-code-widget/
  http://wordpress.org/extend/plugins/exec-php/

An alternate approach would be to place PHP code within the .php files of the Wordpress theme.

You can place your CiviCRM API code within a plugin, thereby getting both APIs to work together and show CiviCRM data.

Basic Example, that will show data of a contact named "Wool Man"
This code can be placed in a page, widget or plugin.
Code: [Select]
<?php
print ('executing php...<br>');
require_once 
"INSERT-YOUR-WEB-ROOT-HERE/wp-content/plugins/civicrm/civicrm.settings.php";
require_once 
'CRM/Core/Config.php';
$config = CRM_Core_Config::singleton( );
require_once 
'api/api.php';
print (
'connected to CiviCRM api 3<br><br>');
$contact = civicrm_api('Contact','Get',array('first_name' => 'Wool', 'last_name' => 'Man', 'version' =>3));
print_r($contact);
?>


« Last Edit: April 23, 2012, 09:08:01 am by Stoob »
Try CiviTeacher: the online video tutorial CiviCRM learning library.

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: Wordpress + CiviCRM Developer Resources
April 06, 2012, 01:03:25 am
This is fantastic. I think it already warrants a Wiki page. :)
CiviHosting and CiviOnline -- The CiviCRM hosting experts, since 2007

See here for the official: What to do if you think you've found a bug.

Erik Hommel

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1773
  • Karma: 59
    • EE-atWork
  • CiviCRM version: all sorts
  • CMS version: Drupal
  • MySQL version: Ubuntu's latest LTS version
  • PHP version: Ubuntu's latest LTS version
Re: Wordpress + CiviCRM Developer Resources
April 07, 2012, 03:07:08 am
Great stuff, thanks!
Consultant/project manager at EEatWork and CiviCooP (http://www.civicoop.org/)

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • Wordpress + CiviCRM Developer Resources

This forum was archived on 2017-11-26.