CiviCRM Shortcodes for WordPress

How Can We Help?

You are here:
< Back

The five possible components are:

  • Contribution: [civicrm component="contribution" id="x"] shows a contribution page specified by the id attribute.
  • Event: [civicrm component="event" action="register" id="x"] and [civicrm component="event" action="info" id="x"] shows either a registration or information page for the event specified by the id attribute.
  • User dashboard: [civicrm component="user-dashboard"] shows the current user’s dashboard page. There are no additional options. To identify what related information you have setup to be displayed within the user dashboard i.e. contributions, memberships, etc. navigate to Administer > Customize Data and Screens > Display Preferences and select all of the information you would like to have visible to the user.
  • Profile: [civicrm component="profile" mode="y" gid="x"] shows a page for displaying a user’s profile. This can be one of 4 modes – edit, view, create or search. The default is create. The gid attribute selects which profile group is displayed.
  • Petition: [civicrm component="petition" id="x"] displays a petition form specified by the id attribute.
  • Form Builder: [civicrm component="afform" name="x"] displays a Form Builder form (afform) page. Where x is the name given to the page, for example: afsearchMemberDirectory

Contribution and Event components can be put in test mode with mode="test"

In addition, any of these can specify a hijack option and they will replace all other content on that page rather than being display inline. This looks like hijack="1".

Force: A force attribute is mentioned in the code but I’m not clear what it does and have not tested it myself: force=1 means it will display the table, force=0 means it will display the search box for the table and you will see the results of the search for the table after you search.

I think force probably only relates to profiles which could have search results and have default values.


Mostly taken from drkane’s answer on civicrm.stackexchange.com with some bits from the official documentation: Using shortcodes to publish CiviCRM content in WordPress.

Leave a Reply

Your email address will not be published. Required fields are marked *