Answers.Body: <p><a href="https://developer.wordpress.org/reference/functions/get_shortcode_regex/" rel="nofollow noreferrer">https://developer.wordpress.org/reference/functions/get_shortcode_regex/</a></p>
  <p>&quot;get_shortcode_regex&quot; doesn't seem to work when nesting CiviCRM shortcodes. I found 2 hacky workarounds.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-02-11T22:07:31.087Z
Answers.Text: Can you elaborate on your hacky workarounds ?
Answers.UserDisplayName: samuelsov
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-02-01T20:11:27.017Z
Answers.LastActivityDate: 2021-02-01T20:11:27.017Z
Answers.UserDisplayName: dsmith63
Answers.Body: <p>I ended up using page tags to tell a php script which pages need to force CiviCRM resources to load.</p>
  <pre><code>if ( function_exists('has_tag') &amp;&amp; function_exists('get_the_id') &amp;&amp; has_tag('logged-in-no-cache', get_the_id()) ) {
      add_action( 'wp_enqueue_scripts', array( civi_wp(), 'front_end_page_load' ), 100 );
  }
  </code></pre>
  <p>This goes in functions.php.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-02-11T22:53:52.120Z
Answers.Text: @samuelsov here's what I've come up with.
Answers.UserDisplayName: dsmith63
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-02-24T15:38:53.663Z
Answers.Text: awesome, it's perfect for my needs
Answers.UserDisplayName: samuelsov
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-02-11T22:53:08.450Z
Answers.LastActivityDate: 2022-02-11T22:53:08.450Z
Answers.UserDisplayName: dsmith63
Body: <p>If I create a new page and include this shortcode, the Civi User Dashboard displays correctly.</p>
  <pre><code>[civicrm component=&quot;user-dashboard&quot;]
  </code></pre>
  <p>If I create a new page but nest the same short code inside of an outer shortcode, several JS files do not get loaded. A section titled &quot;&lt;!-- CiviCRM html header --&gt;&quot; (present in non-nested output) does not output.</p>
  <pre><code>[members_logged_in]
  [civicrm component=&quot;user-dashboard&quot;]
  [/members_logged_in]
  </code></pre>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-02-02T07:09:28.847Z
Comments.Text: Huh, I just thought it was the plugin I was using (Groups). Good to know it is all of them.
Comments.UserDisplayName: David Hayes
Tags: <javascript><html>
Title: Why does nesting Civi shortcodes in Wordpress pages prevent Javascript files from loading?
ThreadText: # Why does nesting Civi shortcodes in Wordpress pages prevent Javascript files from loading?
  
  (Asked by: username_0 on 2021-01-27)
  
  If I create a new page and include this shortcode, the Civi User Dashboard displays correctly.
  
  ```
  [civicrm component="user-dashboard"]
  
  ```
  
  If I create a new page but nest the same short code inside of an outer shortcode, several JS files do not get loaded. A section titled "<!-- CiviCRM html header -->" (present in non-nested output) does not output.
  
  ```
  [members_logged_in]
  [civicrm component="user-dashboard"]
  [/members_logged_in]
  
  ```
  
  **Tags:** javascript, html
  
  > **Comments:**
  > **username_1**: Huh, I just thought it was the plugin I was using (Groups). Good to know it is all of them.  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_0 on 2021-02-01. Score: 2
  
  <https://developer.wordpress.org/reference/functions/get_shortcode_regex/>
  
  "get\_shortcode\_regex" doesn't seem to work when nesting CiviCRM shortcodes. I found 2 hacky workarounds.
  
  > **Comments:**
  > **username_2**: Can you elaborate on your hacky workarounds ?  
  
  ---
  
  ### Answer by username_0 on 2022-02-11. Score: 1
  
  I ended up using page tags to tell a php script which pages need to force CiviCRM resources to load.
  
  ```
  if ( function_exists('has_tag') && function_exists('get_the_id') && has_tag('logged-in-no-cache', get_the_id()) ) {
      add_action( 'wp_enqueue_scripts', array( civi_wp(), 'front_end_page_load' ), 100 );
  }
  
  ```
  
  This goes in functions.php.
  
  > **Comments:**
  > **username_0**: @username_2 here's what I've come up with.  
  > **username_2**: awesome, it's perfect for my needs  
  
  ---
  
  