Answers.Body: <p>If anyone new is having this problem, the solution is to upgrade to CiviCRM 4.7.31+. CiviCRM ships with the BackboneJS library; so do certain WordPress themes. Sometimes that causes a conflict. Conflict mitigation was added in 4.7.31.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-03-18T05:28:30.160Z
Answers.LastActivityDate: 2018-03-18T05:28:30.160Z
Answers.UserDisplayName: Jon G - Megaphone Tech
Answers.Body: <p>Assuming the file you want to load is the one located in the CiviCRM plugin folder at 'civicrm/packages/backbone/backbone-min.js', then you'd use:</p>
  
  <p><code>wp_enqueue_script( 'your_backbone_handle', CIVICRM_PLUGIN_URL . 'civicrm/packages/backbone/backbone-min.js', array(), CIVICRM_PLUGIN_VERSION );</code></p>
  
  <p>See <a href="https://developer.wordpress.org/reference/functions/wp_enqueue_script/" rel="nofollow">https://developer.wordpress.org/reference/functions/wp_enqueue_script/</a></p>
  
  <p>The only slight issue with this is that the constant <code>CIVICRM_PLUGIN_VERSION</code> is not updated with each minor dot release (it should be) which means that you may need to manually bump this each time you upgrade CiviCRM in case it ships with a new version. Replace it with your own version numbering in that case.</p>
  
  <p>Disclaimer: I'm not sure if this is the only Backbone-related file you need to enqueue. Also, this may not solve the issue with your theme but it is the method by which you should target CiviCRM's copy of Backbone :-)</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-05-24T13:12:41.653Z
Answers.Text: Random rabbit trail induced by grep and locate on the above line:  Changing the priority of all the backbone lines to 90+ did nothing for me.  File changed was:  civicrm/civicrm/CRM/UF/Page/ProfileEditor.php
Answers.UserDisplayName: G H
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-05-24T14:18:39.990Z
Answers.Text: Sorry, but I don't understand :-(
Answers.UserDisplayName: Christian Wach
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-05-24T16:06:56.737Z
Answers.Text: Ugh ... Not quite.  Got it to load with `wp_enqueue_script( 'crm.backbone', '/wp-content/plugins/civicrm/civicrm/packages/backbone/backbone-min.js', array(), 4.7);` in the child theme function.php file. It's giving the same error as before, so this isn't helping. I know it's reloading the whole thing because there is an additional error thrown for an unrelated variable when this line is in.  Leaving the line in and changing the theme to a known working theme removes both errors.  So the page is apparently loading as it should be and not getting stomped on as expected. Next try: crm.backbone.js
Answers.UserDisplayName: G H
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-05-24T16:10:29.900Z
Answers.Text: First comment reply:  I did a grep and locate on the backbone-min.js line and it pointed towards the ProfileEditor.php file which had a number of addscript lines with high priorities for the backbone includes.  I dropped those down to 90, hoping that it would supersede the theme, assuming that the theme loaded them at 100.  It was a hack that didn't work.
Answers.UserDisplayName: G H
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-05-24T16:16:22.937Z
Answers.Text: Nope, pointing the wp_enqueue_script at crm.backbone.js also did not work.  Added ReferenceError: CRM is not defined error and page looks the same.  I'm probably just doing it all wrong.
Answers.UserDisplayName: G H
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-05-25T09:10:07.407Z
Answers.Text: It looks to me as though you need to figure out exactly what the issue is and when it is an issue. It's difficult to know what else to suggest at this point, since I'm not clear whether this problem exists on the front-end, back-end, basepage, shortcode or elsewhere. I'd recommend trying Tim's method below as way of untangling yourself from this!
Answers.UserDisplayName: Christian Wach
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-05-23T14:09:42.907Z
Answers.LastActivityDate: 2016-05-23T14:09:42.907Z
Answers.UserDisplayName: Christian Wach
Answers.Body: <p>FWIW, if you want to extend an analogy from the <code>jQuery.noConflict()</code>, you  might try patching <code>js/noconflict.js</code>. The theory is to load files in this order:</p>
  
  <ol>
  <li>Civi's version of each upstream library (jquery, backbone)</li>
  <li>Civi's *.js files (which reference the upstream library)</li>
  <li><code>noconflict.js</code> (which obscures Civi's version)</li>
  </ol>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-05-26T18:28:41.157Z
Answers.Text: This is what I would to see happen, over the question.  I'll try to see if I can't muddle my way through.
Answers.UserDisplayName: G H
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-05-26T18:30:16.637Z
Answers.Text: BTW, is this one of those things where the goal is to move towards Angular.js?
Answers.UserDisplayName: G H
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-10-14T14:08:09.703Z
Answers.Text: If anyone's found a solution to this, please share. For me, I've worked around the whole problem be using the plugin 'Theme Test Drive' https://wordpress.org/plugins/theme-test-drive/ which works for the moment. A more elegant solution would be most welcome.
Answers.UserDisplayName: Graham
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-05-24T22:42:05.333Z
Answers.LastActivityDate: 2016-05-24T22:42:05.333Z
Answers.UserDisplayName: Tim Otten
Body: <p>I've got a WordPress theme that's giving me issues with the Backbone JS module.  According to <a href="https://issues.civicrm.org/jira/browse/CRM-17352" rel="nofollow noreferrer">https://issues.civicrm.org/jira/browse/CRM-17352</a>, it's because CiviCRM isn't running Backbone in no_conflict mode.  Unfortunately, I'm not familiar enough with all of this to figure out where the no_conflict() call would be placed in the code.  </p>
  
  <p>According to <a href="https://civicrm.stackexchange.com/questions/9161/backbone-isnt-loading-on-civi-4-6-11-wp-4-4-1">Backbone isn&#39;t loading on Civi 4.6.11/WP 4.4.1</a>, Andrew West suggests dequeue-ing the theme's loading of Backbone, and enqueue-ing the CiviCRM backbone.  I get the concept, understand how to limit the if statement to the civicrm base page, and already have the child theme, but I'm unclear of how I tell it to enqueue the specific version of Backbone for CiviCRM?</p>
  
  <p>EDIT:  Adding <code>var Backbone = Backbone.noConflict()</code> to wp-content/plugins/civicrm/civicrm/packages/backbone/backbone.js blows up in an impressive array of 15 errors on the Manage Online Event page, with Backbone Undefined.  Scary thing is that it seemed to render more of the page, but still not correct.</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-05-24T22:49:15.920Z
Comments.Text: if I understood correctly, the issue raised because there are two backbone versions being loaded? If so, why not just dequeue the theme's backbone version in Civi's page and let Civi load it's own?
Comments.UserDisplayName: Andrei
Tags: <wordpress><theme><backbone>
Title: Dequeue Backbone from theme load and load CiviCRM Backbone
ThreadText: # Dequeue Backbone from theme load and load CiviCRM Backbone
  
  (Asked by: username_0 on 2016-05-20)
  
  I've got a WordPress theme that's giving me issues with the Backbone JS module. According to <https://issues.civicrm.org/jira/browse/CRM-17352>, it's because CiviCRM isn't running Backbone in no\_conflict mode. Unfortunately, I'm not familiar enough with all of this to figure out where the no\_conflict() call would be placed in the code.
  
  According to [Backbone isn't loading on Civi 4.6.11/WP 4.4.1](https://civicrm.stackexchange.com/questions/9161/backbone-isnt-loading-on-civi-4-6-11-wp-4-4-1), Andrew West suggests dequeue-ing the theme's loading of Backbone, and enqueue-ing the CiviCRM backbone. I get the concept, understand how to limit the if statement to the civicrm base page, and already have the child theme, but I'm unclear of how I tell it to enqueue the specific version of Backbone for CiviCRM?
  
  EDIT: Adding `var Backbone = Backbone.noConflict()` to wp-content/plugins/civicrm/civicrm/packages/backbone/backbone.js blows up in an impressive array of 15 errors on the Manage Online Event page, with Backbone Undefined. Scary thing is that it seemed to render more of the page, but still not correct.
  
  **Tags:** wordpress, theme, backbone
  
  > **Comments:**
  > **username_1**: if I understood correctly, the issue raised because there are two backbone versions being loaded? If so, why not just dequeue the theme's backbone version in Civi's page and let Civi load it's own?  
  
  ---
  
  ## 3 answers
  
  ### Answer by username_2 on 2018-03-18. Score: 1 | Accepted answer
  
  If anyone new is having this problem, the solution is to upgrade to CiviCRM 4.7.31+. CiviCRM ships with the BackboneJS library; so do certain WordPress themes. Sometimes that causes a conflict. Conflict mitigation was added in 4.7.31.
  
  
  ---
  
  ### Answer by username_3 on 2016-05-23. Score: 3
  
  Assuming the file you want to load is the one located in the CiviCRM plugin folder at 'civicrm/packages/backbone/backbone-min.js', then you'd use:
  
  `wp_enqueue_script( 'your_backbone_handle', CIVICRM_PLUGIN_URL . 'civicrm/packages/backbone/backbone-min.js', array(), CIVICRM_PLUGIN_VERSION );`
  
  See <https://developer.wordpress.org/reference/functions/wp_enqueue_script/>
  
  The only slight issue with this is that the constant `CIVICRM_PLUGIN_VERSION` is not updated with each minor dot release (it should be) which means that you may need to manually bump this each time you upgrade CiviCRM in case it ships with a new version. Replace it with your own version numbering in that case.
  
  Disclaimer: I'm not sure if this is the only Backbone-related file you need to enqueue. Also, this may not solve the issue with your theme but it is the method by which you should target CiviCRM's copy of Backbone :-)
  
  > **Comments:**
  > **username_0**: Random rabbit trail induced by grep and locate on the above line:  Changing the priority of all the backbone lines to 90+ did nothing for me.  File changed was:  civicrm/civicrm/CRM/UF/Page/ProfileEditor.php  
  > **username_3**: Sorry, but I don't understand :-(  
  > **username_0**: Ugh ... Not quite.  Got it to load with `wp_enqueue_script( 'crm.backbone', '/wp-content/plugins/civicrm/civicrm/packages/backbone/backbone-min.js', array(), 4.7);` in the child theme function.php file. It's giving the same error as before, so this isn't helping. I know it's reloading the whole thing because there is an additional error thrown for an unrelated variable when this line is in.  Leaving the line in and changing the theme to a known working theme removes both errors.  So the page is apparently loading as it should be and not getting stomped on as expected. Next try: crm.backbone.js  
  > **username_0**: First comment reply:  I did a grep and locate on the backbone-min.js line and it pointed towards the ProfileEditor.php file which had a number of addscript lines with high priorities for the backbone includes.  I dropped those down to 90, hoping that it would supersede the theme, assuming that the theme loaded them at 100.  It was a hack that didn't work.  
  > **username_0**: Nope, pointing the wp_enqueue_script at crm.backbone.js also did not work.  Added ReferenceError: CRM is not defined error and page looks the same.  I'm probably just doing it all wrong.  
  > **username_3**: It looks to me as though you need to figure out exactly what the issue is and when it is an issue. It's difficult to know what else to suggest at this point, since I'm not clear whether this problem exists on the front-end, back-end, basepage, shortcode or elsewhere. I'd recommend trying Tim's method below as way of untangling yourself from this!  
  
  ---
  
  ### Answer by username_4 on 2016-05-24. Score: 2
  
  FWIW, if you want to extend an analogy from the `jQuery.noConflict()`, you might try patching `js/noconflict.js`. The theory is to load files in this order:
  
  1. Civi's version of each upstream library (jquery, backbone)
  2. Civi's \*.js files (which reference the upstream library)
  3. `noconflict.js` (which obscures Civi's version)
  
  > **Comments:**
  > **username_0**: This is what I would to see happen, over the question.  I'll try to see if I can't muddle my way through.  
  > **username_0**: BTW, is this one of those things where the goal is to move towards Angular.js?  
  > **username_5**: If anyone's found a solution to this, please share. For me, I've worked around the whole problem be using the plugin 'Theme Test Drive' https://wordpress.org/plugins/theme-test-drive/ which works for the moment. A more elegant solution would be most welcome.  
  
  ---
  
  