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) »
  • Support »
  • Using CiviCRM »
  • Using CiviEvent (Moderator: Yashodha Chaku) »
  • WP shortcodes
Pages: [1]

Author Topic: WP shortcodes  (Read 286 times)

robinhood

  • I post frequently
  • ***
  • Posts: 153
  • Karma: 6
  • CiviCRM version: 4.5.5
  • CMS version: Drupal 7.34
  • MySQL version: 5.1.56
  • PHP version: 5.3.5
WP shortcodes
December 07, 2014, 09:39:31 am
I see a lot of questions in the forums about using wordpress shortcodes, but my issue is a bit different than most.  I would like to be able to drop a shortcode from an unrelated plugin into a civicrm event page, either in the info page or the registration page.  The shortcode square-bracket text itself is displayed, so I gather that it is not being processed through the wordpress functions which would replace the shortcode by calling the plugin.  Is there a way to make this work? 

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: WP shortcodes
December 07, 2014, 01:20:30 pm

you can potentially do this in a hook (alterContent hook) before the page renders.

if u do so, please share your implementation so others can benefit

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

robinhood

  • I post frequently
  • ***
  • Posts: 153
  • Karma: 6
  • CiviCRM version: 4.5.5
  • CMS version: Drupal 7.34
  • MySQL version: 5.1.56
  • PHP version: 5.3.5
Re: WP shortcodes
December 09, 2014, 04:38:33 pm
Ok here is one way.

Code: [Select]
function wordpress_civicrm_alterContent(&$content, $context, $tplName, &$object) {
$content = do_shortcode($content);
}

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviEvent (Moderator: Yashodha Chaku) »
  • WP shortcodes

This forum was archived on 2017-11-26.